Expand Up @@ -3,13 +3,15 @@ # This file is distributed under the same license as the Python package. # # Translators: # Adrian Liaw <adrianliaw2000@gmail.com>, 2018 # Dr-XYZ <dr.xyz.tw@gmail.com>, 2025 msgid "" msgstr "" "Project-Id-Version: Python 3.13\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" "Last-Translator:Adrian Liaw <adrianliaw2000 @gmail.com>\n" "PO-Revision-Date:2025 -05-28 14:00+0800 \n" "Last-Translator:Dr-XYZ <dr.xyz.tw @gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" "Language: zh_TW\n" Expand All @@ -33,6 +35,9 @@ msgid "" "list functions executed during a program run. It can be used in another " "program or from the command line." msgstr "" ":mod:`trace` 模組可用來追蹤程式執行過程、產生帶註解的陳述式涵蓋範圍串列、輸出" "呼叫者/被呼叫者的關係,以及在程式執行期間被執行的函式串列。它可以在其他程式" "中使用,也可以從命令列啟動。" #: ../../library/trace.rst:18 msgid "`Coverage.py <https://coverage.readthedocs.io/>`_" Expand All @@ -42,17 +47,17 @@ msgstr "`Coverage.py <https://coverage.readthedocs.io/>`_" msgid "" "A popular third-party coverage tool that provides HTML output along with " "advanced features such as branch coverage." msgstr "" msgstr "一款受歡迎的第三方涵蓋範圍工具,提供 HTML 輸出與分支涵蓋等進階功能。 " #: ../../library/trace.rst:25 msgid "Command-Line Usage" msgstr "" msgstr "命令列用法 " #: ../../library/trace.rst:27 msgid "" "The :mod:`trace` module can be invoked from the command line. It can be as " "simple as ::" msgstr "" msgstr ":mod:`trace` 模組可從命令列執行,用法可以非常簡單,如::: " #: ../../library/trace.rst:30 msgid "python -m trace --count -C . somefile.py ..." Expand All @@ -64,22 +69,24 @@ msgid "" "of all Python modules imported during the execution into the current " "directory." msgstr "" "上述命令會執行 :file:`somefile.py`,並將產生執行期間所引入的所有 Python 模組" "的帶註解串列,輸出至目前目錄。" #: ../../library/trace.rst:39 msgid "Display usage and exit." msgstr "" msgstr "顯示用法並結束程式。 " #: ../../library/trace.rst:43 msgid "Display the version of the module and exit." msgstr "" msgstr "顯示模組版本並結束程式。 " #: ../../library/trace.rst:45 msgid "Added ``--module`` option that allows to run an executable module." msgstr "" msgstr "新增 ``--module`` 選項,允許執行可執行模組。 " #: ../../library/trace.rst:49 msgid "Main options" msgstr "" msgstr "主要選項 " #: ../../library/trace.rst:51 msgid "" Expand All @@ -89,97 +96,117 @@ msgid "" "`--listfuncs <-l>` is provided, neither :option:`--count <-c>` nor :option:" "`--trace <-t>` are accepted, and vice versa." msgstr "" "執行 :mod:`trace` 時,至少必須指定以下選項之一。:option:`--listfuncs <-l>` 選" "項與 :option:`--trace <-t>` 及 :option:`--count <-c>` 選項互斥。當提供 :" "option:`--listfuncs <-l>` 時,將不接受 :option:`--count <-c>` 或 :option:`--" "trace <-t>`,反之亦然。" #: ../../library/trace.rst:61 msgid "" "Produce a set of annotated listing files upon program completion that shows " "how many times each statement was executed. See also :option:`--coverdir <-" "C>`, :option:`--file <-f>` and :option:`--no-report <-R>` below." msgstr "" "在程式執行結束時產生一組帶註解串列檔案,顯示每個陳述式被執行的次數。參見下方" "的 :option:`--coverdir <-C>`、:option:`--file <-f>` 及 :option:`--no-report " "<-R>`。" #: ../../library/trace.rst:68 msgid "Display lines as they are executed." msgstr "" msgstr "執行時即時顯示每一行。 " #: ../../library/trace.rst:72 msgid "Display the functions executed by running the program." msgstr "" msgstr "顯示程式執行過程中被呼叫的函式。 " #: ../../library/trace.rst:76 msgid "" "Produce an annotated list from an earlier program run that used the :option:" "`--count <-c>` and :option:`--file <-f>` option. This does not execute any " "code." msgstr "" "從先前使用 :option:`--count <-c>` 與 :option:`--file <-f>` 選項執行過的程式生" "成帶註解的串列,不會執行任何程式碼。" #: ../../library/trace.rst:82 msgid "Display the calling relationships exposed by running the program." msgstr "" msgstr "顯示程式執行時產生的呼叫關係。 " #: ../../library/trace.rst:85 msgid "Modifiers" msgstr "" msgstr "修飾子 " #: ../../library/trace.rst:91 msgid "" "Name of a file to accumulate counts over several tracing runs. Should be " "used with the :option:`--count <-c>` option." msgstr "" "指定用來累積多次追蹤結果的檔案名稱。應與 :option:`--count <-c>` 選項搭配使" "用。" #: ../../library/trace.rst:96 msgid "" "Directory where the report files go. The coverage report for ``package." "module`` is written to file :file:`{dir}/{package}/{module}.cover`." msgstr "" "報告檔案的輸出目錄。``package.module`` 的涵蓋範圍報告將寫入檔案::file:" "`{dir}/{package}/{module}.cover`。" #: ../../library/trace.rst:101 msgid "" "When generating annotated listings, mark lines which were not executed with " "``>>>>>>``." msgstr "" msgstr "在產生帶註解的串列時,使用 ``>>>>>>`` 標記未被執行的程式碼行。 " #: ../../library/trace.rst:106 msgid "" "When using :option:`--count <-c>` or :option:`--report <-r>`, write a brief " "summary to stdout for each file processed." msgstr "" "使用 :option:`--count <-c>` 或 :option:`--report <-r>` 時,會將每個處理過的檔" "案摘要輸出至 stdout。" #: ../../library/trace.rst:111 msgid "" "Do not generate annotated listings. This is useful if you intend to make " "several runs with :option:`--count <-c>`, and then produce a single set of " "annotated listings at the end." msgstr "" "不產生帶註解的串列。若你打算多次使用 :option:`--count <-c>` 執行程式,並在最" "後再統一產生串列,這會很有幫助。" #: ../../library/trace.rst:117 msgid "" "Prefix each line with the time since the program started. Only used while " "tracing." msgstr "" msgstr "在每一行前加上自程式啟動以來的經過時間。僅在追蹤時使用。 " #: ../../library/trace.rst:121 msgid "Filters" msgstr "" msgstr "篩選子 " #: ../../library/trace.rst:123 msgid "These options may be repeated multiple times." msgstr "" msgstr "這些選項可以重複使用多次。 " #: ../../library/trace.rst:129 msgid "" "Ignore each of the given module names and its submodules (if it is a " "package). The argument can be a list of names separated by a comma." msgstr "" "忽略所指定的模組名稱及其子模組(若為套件)。引數可以是以逗號分隔的名稱串列。" #: ../../library/trace.rst:134 msgid "" "Ignore all modules and packages in the named directory and subdirectories. " "The argument can be a list of directories separated by :data:`os.pathsep`." msgstr "" "忽略指定目錄及其子目錄中的所有模組與套件。引數可以是以 :data:`os.pathsep` 分" "隔的目錄串列。" #: ../../library/trace.rst:140 msgid "Programmatic Interface" msgstr "" msgstr "程式介面 " #: ../../library/trace.rst:145 msgid "" Expand All @@ -194,43 +221,60 @@ msgid "" "count information. *timing* enables a timestamp relative to when tracing " "was started to be displayed." msgstr "" "建立一個物件以追蹤單一陳述式或運算式的執行。所有參數皆為可選的。*count* 啟用" "行數統計,*trace* 啟用逐行追蹤執行,*countfuncs* 可列出執行期間呼叫的函式," "*countcallers* 追蹤呼叫關係,*ignoremods* 是要忽略的模組或套件名稱串列," "*ignoredirs* 是其模組或套件應被忽略的目錄串列,*infile* 是讀取儲存計數資料的" "檔案名稱,*outfile* 是要寫入更新後計數資料的檔案名稱,*timing* 則會顯示自開始" "追蹤以來的時間戳記。" #: ../../library/trace.rst:158 msgid "" "Execute the command and gather statistics from the execution with the " "current tracing parameters. *cmd* must be a string or code object, suitable " "for passing into :func:`exec`." msgstr "" "執行指令,並依目前追蹤參數收集執行統計資料。*cmd* 必須是可傳入 :func:`exec` " "的字串或程式碼物件。" #: ../../library/trace.rst:164 msgid "" "Execute the command and gather statistics from the execution with the " "current tracing parameters, in the defined global and local environments. " "If not defined, *globals* and *locals* default to empty dictionaries." msgstr "" "在指定的全域與區域命名空間中,根據目前的追蹤參數執行指令並收集統計資料。若未" "指定,*globals* 與 *locals* 預設為空字典。" #: ../../library/trace.rst:171 msgid "" "Call *func* with the given arguments under control of the :class:`Trace` " "object with the current tracing parameters." msgstr "" "在目前的追蹤參數下,使用 :class:`Trace` 物件控制呼叫 *func*,並傳入指定的引" "數。" #: ../../library/trace.rst:176 msgid "" "Return a :class:`CoverageResults` object that contains the cumulative " "results of all previous calls to ``run``, ``runctx`` and ``runfunc`` for the " "given :class:`Trace` instance. Does not reset the accumulated trace results." msgstr "" "回傳一個 :class:`CoverageResults` 物件,包含指定 :class:`Trace` 實例中所有先" "前對 ``run``、``runctx`` 與 ``runfunc`` 呼叫的累積結果。不會重設累積的追蹤結" "果。" #: ../../library/trace.rst:183 msgid "" "A container for coverage results, created by :meth:`Trace.results`. Should " "not be created directly by the user." msgstr "" "一個用來儲存涵蓋範圍結果的容器,由 :meth:`Trace.results` 建立。不應由使用者直" "接建立。" #: ../../library/trace.rst:188 msgid "Merge in data from another :class:`CoverageResults` object." msgstr "" msgstr "合併來自另一個 :class:`CoverageResults` 物件的資料。 " #: ../../library/trace.rst:193 msgid "" Expand All @@ -240,21 +284,27 @@ msgid "" "be output. If ``None``, the results for each source file are placed in its " "directory." msgstr "" "寫入涵蓋範圍結果。將 *show_missing* 設為真可顯示未被執行的程式碼行;將 " "*summary* 設為真則會在輸出中加入每個模組的涵蓋範圍摘要。*coverdir* 指定輸出涵" "蓋範圍結果檔案的目錄,若為 ``None``,則每個原始檔案的結果會輸出至其所在目錄" "中。" #: ../../library/trace.rst:199 msgid "" "If *ignore_missing_files* is ``True``, coverage counts for files that no " "longer exist are silently ignored. Otherwise, a missing file will raise a :" "exc:`FileNotFoundError`." msgstr "" "若 *ignore_missing_files* 為 ``True``,則會忽略那些已不存在的檔案的涵蓋範圍資" "料,不會顯示任何錯誤。否則,缺少的檔案將會引發 :exc:`FileNotFoundError`。" #: ../../library/trace.rst:203 msgid "Added *ignore_missing_files* parameter." msgstr "" msgstr "新增 *ignore_missing_files* 參數。 " #: ../../library/trace.rst:206 msgid "A simple example demonstrating the use of the programmatic interface::" msgstr "" msgstr "以下是一個簡單範例,展示如何使用程式介面: " #: ../../library/trace.rst:208 msgid "" Expand All @@ -275,3 +325,19 @@ msgid "" "r = tracer.results()\n" "r.write_results(show_missing=True, coverdir=\".\")" msgstr "" "import sys\n" "import trace\n" "\n" "# 建立一個 Trace 物件,指定要忽略的目錄,\n" "# 並設定是否進行追蹤、行數統計或兩者皆做。\n" "tracer = trace.Trace(\n" " ignoredirs=[sys.prefix, sys.exec_prefix],\n" " trace=0,\n" " count=1)\n" "\n" "# 使用該 tracer 執行新的指令\n" "tracer.run('main()')\n" "\n" "# 建立報告,將輸出放在目前目錄中\n" "r = tracer.results()\n" "r.write_results(show_missing=True, coverdir=\".\")"