@@ -33,6 +33,9 @@ msgid ""
3333"list functions executed during a program run. It can be used in another "
3434"program or from the command line."
3535msgstr ""
36+ ":mod:`trace` 模組可用來追蹤程式執行過程、產生帶註解的陳述式涵蓋範圍串列、輸出"
37+ "呼叫者/被呼叫者的關係,以及在程式執行期間被執行的函式串列。它可以在其他程式"
38+ "中使用,也可以從命令列啟動。"
3639
3740#: ../../library/trace.rst:18
3841msgid "`Coverage.py <https://coverage.readthedocs.io/>`_"
@@ -42,17 +45,17 @@ msgstr "`Coverage.py <https://coverage.readthedocs.io/>`_"
4245msgid ""
4346"A popular third-party coverage tool that provides HTML output along with "
4447"advanced features such as branch coverage."
45- msgstr ""
48+ msgstr "一款受歡迎的第三方涵蓋範圍工具,提供 HTML 輸出與分支涵蓋等進階功能。 "
4649
4750#: ../../library/trace.rst:25
4851msgid "Command-Line Usage"
49- msgstr ""
52+ msgstr "命令列用法 "
5053
5154#: ../../library/trace.rst:27
5255msgid ""
5356"The :mod:`trace` module can be invoked from the command line. It can be as "
5457"simple as ::"
55- msgstr ""
58+ msgstr ":mod:`trace` 模組可從命令列執行,用法可以非常簡單,如::: "
5659
5760#: ../../library/trace.rst:30
5861msgid "python -m trace --count -C . somefile.py ..."
@@ -64,22 +67,24 @@ msgid ""
6467"of all Python modules imported during the execution into the current "
6568"directory."
6669msgstr ""
70+ "上述命令會執行 :file:`somefile.py`,並將產生執行期間所引入的所有 Python 模組"
71+ "的帶註解串列,輸出至目前目錄。"
6772
6873#: ../../library/trace.rst:39
6974msgid "Display usage and exit."
70- msgstr ""
75+ msgstr "顯示用法並結束程式。 "
7176
7277#: ../../library/trace.rst:43
7378msgid "Display the version of the module and exit."
74- msgstr ""
79+ msgstr "顯示模組版本並結束程式。 "
7580
7681#: ../../library/trace.rst:45
7782msgid "Added ``--module`` option that allows to run an executable module."
78- msgstr ""
83+ msgstr "新增 ``--module`` 選項,允許執行可執行模組。 "
7984
8085#: ../../library/trace.rst:49
8186msgid "Main options"
82- msgstr ""
87+ msgstr "主要選項 "
8388
8489#: ../../library/trace.rst:51
8590msgid ""
@@ -89,97 +94,117 @@ msgid ""
8994"`--listfuncs <-l>` is provided, neither :option:`--count <-c>` nor :option:"
9095"`--trace <-t>` are accepted, and vice versa."
9196msgstr ""
97+ "執行 :mod:`trace` 時,至少必須指定以下選項之一。:option:`--listfuncs <-l>` 選"
98+ "項與 :option:`--trace <-t>` 及 :option:`--count <-c>` 選項互斥。當提供 :"
99+ "option:`--listfuncs <-l>` 時,將不接受 :option:`--count <-c>` 或 :option:`--"
100+ "trace <-t>`,反之亦然。"
92101
93102#: ../../library/trace.rst:61
94103msgid ""
95104"Produce a set of annotated listing files upon program completion that shows "
96105"how many times each statement was executed. See also :option:`--coverdir <-"
97106"C>`, :option:`--file <-f>` and :option:`--no-report <-R>` below."
98107msgstr ""
108+ "在程式執行結束時產生一組帶註解串列檔案,顯示每個陳述式被執行的次數。參見下方"
109+ "的 :option:`--coverdir <-C>`、:option:`--file <-f>` 及 :option:`--no-report "
110+ "<-R>`。"
99111
100112#: ../../library/trace.rst:68
101113msgid "Display lines as they are executed."
102- msgstr ""
114+ msgstr "執行時即時顯示每一行。 "
103115
104116#: ../../library/trace.rst:72
105117msgid "Display the functions executed by running the program."
106- msgstr ""
118+ msgstr "顯示程式執行過程中被呼叫的函式。 "
107119
108120#: ../../library/trace.rst:76
109121msgid ""
110122"Produce an annotated list from an earlier program run that used the :option:"
111123"`--count <-c>` and :option:`--file <-f>` option. This does not execute any "
112124"code."
113125msgstr ""
126+ "從先前使用 :option:`--count <-c>` 與 :option:`--file <-f>` 選項執行過的程式生"
127+ "成帶註解的串列,不會執行任何程式碼。"
114128
115129#: ../../library/trace.rst:82
116130msgid "Display the calling relationships exposed by running the program."
117- msgstr ""
131+ msgstr "顯示程式執行時產生的呼叫關係。 "
118132
119133#: ../../library/trace.rst:85
120134msgid "Modifiers"
121- msgstr ""
135+ msgstr "修飾子 "
122136
123137#: ../../library/trace.rst:91
124138msgid ""
125139"Name of a file to accumulate counts over several tracing runs. Should be "
126140"used with the :option:`--count <-c>` option."
127141msgstr ""
142+ "指定用來累積多次追蹤結果的檔案名稱。應與 :option:`--count <-c>` 選項搭配使"
143+ "用。"
128144
129145#: ../../library/trace.rst:96
130146msgid ""
131147"Directory where the report files go. The coverage report for ``package."
132148"module`` is written to file :file:`{dir}/{package}/{module}.cover`."
133149msgstr ""
150+ "報告檔案的輸出目錄。``package.module`` 的涵蓋範圍報告將寫入檔案::file:"
151+ "`{dir}/{package}/{module}.cover`。"
134152
135153#: ../../library/trace.rst:101
136154msgid ""
137155"When generating annotated listings, mark lines which were not executed with "
138156"``>>>>>>``."
139- msgstr ""
157+ msgstr "在產生帶註解的串列時,使用 ``>>>>>>`` 標記未被執行的程式碼行。 "
140158
141159#: ../../library/trace.rst:106
142160msgid ""
143161"When using :option:`--count <-c>` or :option:`--report <-r>`, write a brief "
144162"summary to stdout for each file processed."
145163msgstr ""
164+ "使用 :option:`--count <-c>` 或 :option:`--report <-r>` 時,會將每個處理過的檔"
165+ "案摘要輸出至 stdout。"
146166
147167#: ../../library/trace.rst:111
148168msgid ""
149169"Do not generate annotated listings. This is useful if you intend to make "
150170"several runs with :option:`--count <-c>`, and then produce a single set of "
151171"annotated listings at the end."
152172msgstr ""
173+ "不產生帶註解的串列。若你打算多次使用 :option:`--count <-c>` 執行程式,並在最"
174+ "後再統一產生串列,這會很有幫助。"
153175
154176#: ../../library/trace.rst:117
155177msgid ""
156178"Prefix each line with the time since the program started. Only used while "
157179"tracing."
158- msgstr ""
180+ msgstr "在每一行前加上自程式啟動以來的經過時間。僅在追蹤時使用。 "
159181
160182#: ../../library/trace.rst:121
161183msgid "Filters"
162- msgstr ""
184+ msgstr "篩選子 "
163185
164186#: ../../library/trace.rst:123
165187msgid "These options may be repeated multiple times."
166- msgstr ""
188+ msgstr "這些選項可以重複使用多次。 "
167189
168190#: ../../library/trace.rst:129
169191msgid ""
170192"Ignore each of the given module names and its submodules (if it is a "
171193"package). The argument can be a list of names separated by a comma."
172194msgstr ""
195+ "忽略所指定的模組名稱及其子模組(若為套件)。引數可以是以逗號分隔的名稱串列。"
173196
174197#: ../../library/trace.rst:134
175198msgid ""
176199"Ignore all modules and packages in the named directory and subdirectories. "
177200"The argument can be a list of directories separated by :data:`os.pathsep`."
178201msgstr ""
202+ "忽略指定目錄及其子目錄中的所有模組與套件。引數可以是以 :data:`os.pathsep` 分"
203+ "隔的目錄串列。"
179204
180205#: ../../library/trace.rst:140
181206msgid "Programmatic Interface"
182- msgstr ""
207+ msgstr "程式介面 "
183208
184209#: ../../library/trace.rst:145
185210msgid ""
@@ -194,43 +219,60 @@ msgid ""
194219"count information. *timing* enables a timestamp relative to when tracing "
195220"was started to be displayed."
196221msgstr ""
222+ "建立一個物件以追蹤單一陳述式或運算式的執行。所有參數皆為可選的。*count* 啟用"
223+ "行數統計,*trace* 啟用逐行追蹤執行,*countfuncs* 可列出執行期間呼叫的函式,"
224+ "*countcallers* 追蹤呼叫關係,*ignoremods* 是要忽略的模組或套件名稱串列,"
225+ "*ignoredirs* 是其模組或套件應被忽略的目錄串列,*infile* 是讀取儲存計數資料的"
226+ "檔案名稱,*outfile* 是要寫入更新後計數資料的檔案名稱,*timing* 則會顯示自開始"
227+ "追蹤以來的時間戳記。"
197228
198229#: ../../library/trace.rst:158
199230msgid ""
200231"Execute the command and gather statistics from the execution with the "
201232"current tracing parameters. *cmd* must be a string or code object, suitable "
202233"for passing into :func:`exec`."
203234msgstr ""
235+ "執行指令,並依目前追蹤參數收集執行統計資料。*cmd* 必須是可傳入 :func:`exec` "
236+ "的字串或程式碼物件。"
204237
205238#: ../../library/trace.rst:164
206239msgid ""
207240"Execute the command and gather statistics from the execution with the "
208241"current tracing parameters, in the defined global and local environments. "
209242"If not defined, *globals* and *locals* default to empty dictionaries."
210243msgstr ""
244+ "在指定的全域與區域命名空間中,根據目前的追蹤參數執行指令並收集統計資料。若未"
245+ "指定,*globals* 與 *locals* 預設為空字典。"
211246
212247#: ../../library/trace.rst:171
213248msgid ""
214249"Call *func* with the given arguments under control of the :class:`Trace` "
215250"object with the current tracing parameters."
216251msgstr ""
252+ "在目前的追蹤參數下,使用 :class:`Trace` 物件控制呼叫 *func*,並傳入指定的引"
253+ "數。"
217254
218255#: ../../library/trace.rst:176
219256msgid ""
220257"Return a :class:`CoverageResults` object that contains the cumulative "
221258"results of all previous calls to ``run``, ``runctx`` and ``runfunc`` for the "
222259"given :class:`Trace` instance. Does not reset the accumulated trace results."
223260msgstr ""
261+ "回傳一個 :class:`CoverageResults` 物件,包含指定 :class:`Trace` 實例中所有先"
262+ "前對 ``run``、``runctx`` 與 ``runfunc`` 呼叫的累積結果。不會重設累積的追蹤結"
263+ "果。"
224264
225265#: ../../library/trace.rst:183
226266msgid ""
227267"A container for coverage results, created by :meth:`Trace.results`. Should "
228268"not be created directly by the user."
229269msgstr ""
270+ "一個用來儲存涵蓋範圍結果的容器,由 :meth:`Trace.results` 建立。不應由使用者直"
271+ "接建立。"
230272
231273#: ../../library/trace.rst:188
232274msgid "Merge in data from another :class:`CoverageResults` object."
233- msgstr ""
275+ msgstr "合併來自另一個 :class:`CoverageResults` 物件的資料。 "
234276
235277#: ../../library/trace.rst:193
236278msgid ""
@@ -240,21 +282,27 @@ msgid ""
240282"be output. If ``None``, the results for each source file are placed in its "
241283"directory."
242284msgstr ""
285+ "寫入涵蓋範圍結果。將 *show_missing* 設為真可顯示未被執行的程式碼行;將 "
286+ "*summary* 設為真則會在輸出中加入每個模組的涵蓋範圍摘要。*coverdir* 指定輸出涵"
287+ "蓋範圍結果檔案的目錄,若為 ``None``,則每個原始檔案的結果會輸出至其所在目錄"
288+ "中。"
243289
244290#: ../../library/trace.rst:199
245291msgid ""
246292"If *ignore_missing_files* is ``True``, coverage counts for files that no "
247293"longer exist are silently ignored. Otherwise, a missing file will raise a :"
248294"exc:`FileNotFoundError`."
249295msgstr ""
296+ "若 *ignore_missing_files* 為 ``True``,則會忽略那些已不存在的檔案的涵蓋範圍資"
297+ "料,不會顯示任何錯誤。否則,缺少的檔案將會引發 :exc:`FileNotFoundError`。"
250298
251299#: ../../library/trace.rst:203
252300msgid "Added *ignore_missing_files* parameter."
253- msgstr ""
301+ msgstr "新增 *ignore_missing_files* 參數。 "
254302
255303#: ../../library/trace.rst:206
256304msgid "A simple example demonstrating the use of the programmatic interface::"
257- msgstr ""
305+ msgstr "以下是一個簡單範例,展示如何使用程式介面: "
258306
259307#: ../../library/trace.rst:208
260308msgid ""
@@ -275,3 +323,19 @@ msgid ""
275323"r = tracer.results()\n"
276324"r.write_results(show_missing=True, coverdir=\" .\" )"
277325msgstr ""
326+ "import sys\n"
327+ "import trace\n"
328+ "\n"
329+ "# 建立一個 Trace 物件,指定要忽略的目錄,\n"
330+ "# 並設定是否進行追蹤、行數統計或兩者皆做。\n"
331+ "tracer = trace.Trace(\n"
332+ " ignoredirs=[sys.prefix, sys.exec_prefix],\n"
333+ " trace=0,\n"
334+ " count=1)\n"
335+ "\n"
336+ "# 使用該 tracer 執行新的指令\n"
337+ "tracer.run('main()')\n"
338+ "\n"
339+ "# 建立報告,將輸出放在目前目錄中\n"
340+ "r = tracer.results()\n"
341+ "r.write_results(show_missing=True, coverdir=\" .\" )"