Skip to content

Commit

Permalink
Sync with CPython 3.13 (python#1008)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: W. H. Wang <[email protected]>
  • Loading branch information
3 people authored Dec 29, 2024
1 parent e7b5675 commit f3042a1
Show file tree
Hide file tree
Showing 39 changed files with 3,548 additions and 2,711 deletions.
181 changes: 91 additions & 90 deletions c-api/object.po

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion faq/library.po
Original file line number Diff line number Diff line change
Expand Up @@ -1301,7 +1301,7 @@ msgstr "``uniform(a, b)`` 會選擇 [a, b) 範圍內的浮點數。"
#: ../../faq/library.rst:805
msgid ""
"``normalvariate(mean, sdev)`` samples the normal (Gaussian) distribution."
msgstr "``normalvariate(mean, sdev)`` 對常態(高斯)分佈進行採樣 (sample)。"
msgstr "``normalvariate(mean, sdev)`` 對常態(高斯)分佈進行取樣 (sample)。"

#: ../../faq/library.rst:807
msgid "Some higher-level functions operate on sequences directly, such as:"
Expand Down
11 changes: 8 additions & 3 deletions faq/programming.po
Original file line number Diff line number Diff line change
Expand Up @@ -4205,7 +4205,7 @@ msgid ""
msgstr ""
"模組可以透過查看預定義的全域變數 ``__name__`` 來找出自己的模組名稱。如果它的"
"值為``'__main__'``,則該程式作為腳本運行。許多通常透過引入使用的模組還提供命"
"令行界面或自檢,只有在檢查 ``__name__`` 後才執行此程式碼: ::"
"令行介面或自檢,只有在檢查 ``__name__`` 後才執行此程式碼: ::"

#: ../../faq/programming.rst:2134
msgid ""
Expand All @@ -4216,11 +4216,16 @@ msgid ""
"if __name__ == '__main__':\n"
" main()"
msgstr ""
"def main():\n"
" print('Running test...')\n"
" ...\n"
"\n"
"if __name__ == '__main__':\n"
" main()"

#: ../../faq/programming.rst:2143
#, fuzzy
msgid "How can I have modules that mutually import each other?"
msgstr "我怎樣才能擁有相互引入的模組?"
msgstr "要怎樣才能擁有相互引入的模組?"

#: ../../faq/programming.rst:2145
msgid "Suppose you have the following modules:"
Expand Down
122 changes: 85 additions & 37 deletions howto/argparse-optparse.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,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: 2024-12-29 11:18+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
Expand All @@ -16,103 +16,151 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

#: ../../howto/argparse-optparse.rst:7
msgid "Upgrading optparse code"
msgstr "升級 optparse 程式碼"
#: ../../howto/argparse-optparse.rst:8
msgid "Migrating ``optparse`` code to ``argparse``"
msgstr "將 ``optparse`` 程式碼遷移到 ``argparse``"

#: ../../howto/argparse-optparse.rst:9
#: ../../howto/argparse-optparse.rst:10
msgid ""
"Originally, the :mod:`argparse` module had attempted to maintain "
"compatibility with :mod:`optparse`. However, :mod:`optparse` was difficult "
"to extend transparently, particularly with the changes required to support "
"``nargs=`` specifiers and better usage messages. When most everything in :"
"mod:`optparse` had either been copy-pasted over or monkey-patched, it no "
"longer seemed practical to try to maintain the backwards compatibility."
"The :mod:`argparse` module offers several higher level features not natively "
"provided by the :mod:`optparse` module, including:"
msgstr ""
":mod:`argparse` 模組提供了一些高階功能,這些功能在 :mod:`optparse` 模組中並未"
"原生提供,包括:"

#: ../../howto/argparse-optparse.rst:16
msgid ""
"The :mod:`argparse` module improves on the :mod:`optparse` module in a "
"number of ways including:"
msgstr ""

#: ../../howto/argparse-optparse.rst:19
#: ../../howto/argparse-optparse.rst:13
msgid "Handling positional arguments."
msgstr ""
msgstr "處理位置引數。"

#: ../../howto/argparse-optparse.rst:20
#: ../../howto/argparse-optparse.rst:14
msgid "Supporting subcommands."
msgstr ""
msgstr "支援子命令。"

#: ../../howto/argparse-optparse.rst:21
#: ../../howto/argparse-optparse.rst:15
msgid "Allowing alternative option prefixes like ``+`` and ``/``."
msgstr ""
msgstr "允許替代選項前綴,如 ``+`` 和 ``/``。"

#: ../../howto/argparse-optparse.rst:22
#: ../../howto/argparse-optparse.rst:16
msgid "Handling zero-or-more and one-or-more style arguments."
msgstr ""
"處理零或多個 (zero-or-more) 和一個或多個 (and one-or-more) 樣式的引數。"

#: ../../howto/argparse-optparse.rst:23
#: ../../howto/argparse-optparse.rst:17
msgid "Producing more informative usage messages."
msgstr ""
msgstr "產生更多資訊的使用訊息。"

#: ../../howto/argparse-optparse.rst:24
#: ../../howto/argparse-optparse.rst:18
msgid "Providing a much simpler interface for custom ``type`` and ``action``."
msgstr "為自訂 ``type`` 和 ``action`` 提供了一個更簡單的介面。"

#: ../../howto/argparse-optparse.rst:20
msgid ""
"Originally, the :mod:`argparse` module attempted to maintain compatibility "
"with :mod:`optparse`. However, the fundamental design differences between "
"supporting declarative command line option processing (while leaving "
"positional argument processing to application code), and supporting both "
"named options and positional arguments in the declarative interface mean "
"that the API has diverged from that of ``optparse`` over time."
msgstr ""
"最初 :mod:`argparse` 模組試圖保持與 :mod:`optparse` 的相容性,但在基礎設計上"
"的存在差異 -- 支援宣告式 (declarative) 命令列選項處理 (同時將位置引數處理留給"
"應用程式的程式碼) 和在宣告式介面中支援命名選項 (named options) 和位置引數 -- "
"代表 API 隨著時間的推移已經與 ``optparse`` API 分歧。"

#: ../../howto/argparse-optparse.rst:27
msgid ""
"As described in :ref:`choosing-an-argument-parser`, applications that are "
"currently using :mod:`optparse` and are happy with the way it works can just "
"continue to use ``optparse``."
msgstr ""
"如 :ref:`choosing-an-argument-parser` 中所述,目前使用 :mod:`optparse` 並對其"
"運作方式滿意的應用程式可以繼續使用 ``optparse``。"

#: ../../howto/argparse-optparse.rst:31
msgid ""
"Application developers that are considering migrating should also review the "
"list of intrinsic behavioural differences described in that section before "
"deciding whether or not migration is desirable."
msgstr ""
"在決定是否遷移之前,應用程式開發人員應該先檢閱該段落中描述的內在行為差異清"
"單,來決定是否值得遷移。"

#: ../../howto/argparse-optparse.rst:26
msgid "A partial upgrade path from :mod:`optparse` to :mod:`argparse`:"
#: ../../howto/argparse-optparse.rst:35
msgid ""
"For applications that do choose to migrate from :mod:`optparse` to :mod:"
"`argparse`, the following suggestions should be helpful:"
msgstr ""
"對於選擇從 :mod:`optparse` 遷移到 :mod:`argparse` 的應用程式,以下建議應會有"
"所幫助:"

#: ../../howto/argparse-optparse.rst:28
#: ../../howto/argparse-optparse.rst:38
msgid ""
"Replace all :meth:`optparse.OptionParser.add_option` calls with :meth:"
"`ArgumentParser.add_argument` calls."
msgstr ""
"將所有 :meth:`optparse.OptionParser.add_option` 呼叫替換為 :meth:"
"`ArgumentParser.add_argument` 呼叫。"

#: ../../howto/argparse-optparse.rst:31
#: ../../howto/argparse-optparse.rst:41
msgid ""
"Replace ``(options, args) = parser.parse_args()`` with ``args = parser."
"parse_args()`` and add additional :meth:`ArgumentParser.add_argument` calls "
"for the positional arguments. Keep in mind that what was previously called "
"``options``, now in the :mod:`argparse` context is called ``args``."
msgstr ""
"將 ``(options, args) = parser.parse_args()`` 替換為 ``args = parser."
"parse_args()``,並為位置引數新增額外的 :meth:`ArgumentParser.add_argument` 呼"
"叫。請記住,以前稱為 ``options`` 的東西,在 :mod:`argparse` 情境中現在稱為 "
"``args``。"

#: ../../howto/argparse-optparse.rst:36
#: ../../howto/argparse-optparse.rst:46
msgid ""
"Replace :meth:`optparse.OptionParser.disable_interspersed_args` by using :"
"meth:`~ArgumentParser.parse_intermixed_args` instead of :meth:"
"`~ArgumentParser.parse_args`."
msgstr ""
"使用 :meth:`~ArgumentParser.parse_intermixed_args` 來替換掉 :meth:`optparse."
"OptionParser.disable_interspersed_args`,而不是使用 :meth:`~ArgumentParser."
"parse_args`。"

#: ../../howto/argparse-optparse.rst:40
#: ../../howto/argparse-optparse.rst:50
msgid ""
"Replace callback actions and the ``callback_*`` keyword arguments with "
"``type`` or ``action`` arguments."
msgstr ""
"將回呼動作和 ``callback_*`` 關鍵字引數替換為 ``type`` 或 ``action`` 引數。"

#: ../../howto/argparse-optparse.rst:43
#: ../../howto/argparse-optparse.rst:53
msgid ""
"Replace string names for ``type`` keyword arguments with the corresponding "
"type objects (e.g. int, float, complex, etc)."
msgstr ""
"將 ``type`` 關鍵字引數的字串名稱替換為相應的類型物件 (例如 int、float、"
"complex 等)。"

#: ../../howto/argparse-optparse.rst:46
#: ../../howto/argparse-optparse.rst:56
msgid ""
"Replace :class:`optparse.Values` with :class:`Namespace` and :exc:`optparse."
"OptionError` and :exc:`optparse.OptionValueError` with :exc:`ArgumentError`."
msgstr ""
"將 :class:`optparse.Values` 替換為 :class:`Namespace`,並將 :exc:`optparse."
"OptionError` 和 :exc:`optparse.OptionValueError` 替換為 :exc:"
"`ArgumentError`。"

#: ../../howto/argparse-optparse.rst:50
#: ../../howto/argparse-optparse.rst:60
msgid ""
"Replace strings with implicit arguments such as ``%default`` or ``%prog`` "
"with the standard Python syntax to use dictionaries to format strings, that "
"is, ``%(default)s`` and ``%(prog)s``."
msgstr ""
"將隱式引數的字串,如 ``%default`` 或 ``%prog`` 替換為使用字典來格式化字串的標"
"準 Python 語法,即 ``%(default)s`` 和 ``%(prog)s``。"

#: ../../howto/argparse-optparse.rst:54
#: ../../howto/argparse-optparse.rst:64
msgid ""
"Replace the OptionParser constructor ``version`` argument with a call to "
"``parser.add_argument('--version', action='version', version='<the "
"version>')``."
msgstr ""
"將 OptionParser 建構函式的 ``version`` 引數替換為呼叫 ``parser."
"add_argument('--version', action='version', version='<the version>')``。"
Loading

0 comments on commit f3042a1

Please sign in to comment.