Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions c-api/dict.po
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,9 @@ msgid "If the key is missing, set *\\*result* to ``NULL`` and return ``0``."
msgstr "如果鍵不存在,將 *\\*result* 設為 ``NULL`` 並回傳 ``0``。"

#: ../../c-api/dict.rst:136
#, fuzzy
msgid ""
"On error, raise an exception, set *\\*result* to ``NULL`` and return ``-1``."
msgstr "錯誤發生時,引發一個例外並回傳 ``-1``。"
msgstr "錯誤發生時,引發一個例外,將 *\\*result* 設為 ``NULL`` 並回傳 ``-1``。"

#: ../../c-api/dict.rst:145
msgid "See also the :c:func:`PyObject_GetItem` function."
Expand Down
4 changes: 1 addition & 3 deletions c-api/unicode.po
Original file line number Diff line number Diff line change
Expand Up @@ -1021,11 +1021,10 @@ msgid ""
msgstr ""

#: ../../c-api/unicode.rst:752
#, fuzzy
msgid ""
"Return the number of written characters, or return ``-1`` and raise an "
"exception on error."
msgstr "成功時回傳字元,發生錯誤時設定例外並回傳 ``-1``。"
msgstr "回傳已寫入的字元數,發生錯誤時引發例外並回傳 ``-1``。"

#: ../../c-api/unicode.rst:761
msgid ""
Expand Down Expand Up @@ -1464,7 +1463,6 @@ msgid ""
msgstr ""

#: ../../c-api/unicode.rst:1163 ../../c-api/unicode.rst:1185
#, fuzzy
msgid "The return type is now ``const char *`` rather than ``char *``."
msgstr "回傳型別現在是 ``const char *`` 而不是 ``char *``。"

Expand Down
12 changes: 5 additions & 7 deletions library/ast.po
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,6 @@ msgid ""
msgstr ""

#: ../../library/ast.rst:288
#, fuzzy
msgid ""
">>> print(ast.dump(ast.parse('123', mode='eval'), indent=4))\n"
"Expression(\n"
Expand All @@ -830,13 +829,12 @@ msgid ""
"Expression(\n"
" body=Constant(value='hello', kind='u'))"
msgstr ""
">>> print(ast.dump(ast.parse('{1, 2, 3}', mode='eval'), indent=4))\n"
">>> print(ast.dump(ast.parse('123', mode='eval'), indent=4))\n"
"Expression(\n"
" body=Set(\n"
" elts=[\n"
" Constant(value=1),\n"
" Constant(value=2),\n"
" Constant(value=3)]))"
" body=Constant(value=123))\n"
">>> print(ast.dump(ast.parse(\"u'hello'\", mode='eval'), indent=4))\n"
"Expression(\n"
" body=Constant(value='hello', kind='u'))"

#: ../../library/ast.rst:300
msgid ""
Expand Down
29 changes: 13 additions & 16 deletions library/base64.po
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ msgid "**Source code:** :source:`Lib/base64.py`"
msgstr "**原始碼:** :source:`Lib/base64.py`"

#: ../../library/base64.rst:16
#, fuzzy
msgid ""
"This module provides functions for encoding binary data to printable ASCII "
"characters and decoding such encodings back to binary data. This includes "
Expand All @@ -38,7 +37,9 @@ msgid ""
msgstr ""
"這個模組提供將二進位資料編碼成可顯示 ASCII 字元以及解碼回原始資料的功能。這包"
"括了 :rfc:`4648` 中\\ :ref:`指定的編碼 <base64-rfc-4648>`\\ (Base64、Base32 "
"和 Base16)和非標準的 :ref:`Base85 編碼 <base64-base-85>`。"
"和 Base16)、`PDF 2.0 <https://pdfa.org/resource/iso-32000-2/>`_ 中指定的"
":ref:`Base85 編碼 <base64-base-85>`,以及其他地方使用的 Base85 非標準變"
"體。"

#: ../../library/base64.rst:24
msgid ""
Expand Down Expand Up @@ -362,15 +363,14 @@ msgstr ""
"傳編碼後的 :class:`bytes`。"

#: ../../library/base64.rst:224
#, fuzzy
msgid ""
"*foldspaces* is an optional flag that uses the special short sequence 'y' "
"instead of 4 consecutive spaces (ASCII 0x20) as supported by 'btoa'. This "
"feature is not supported by the standard encoding used in PDF."
msgstr ""
"*foldspaces* 是一個可選的旗標,它使用特殊的短序列 'y' 來替代連續的 4 個空格 "
"(ASCII 0x20),這是由 'btoa' 支援的功能。這個特性不被「標準」的 Ascii85 編碼所"
"支援。"
"(ASCII 0x20),這是由 'btoa' 支援的功能。這個特性不被 PDF 中使用的標準編碼所支"
"。"

#: ../../library/base64.rst:228
msgid ""
Expand Down Expand Up @@ -406,14 +406,14 @@ msgstr ""
"ASCII 字串 *b*,並回傳解碼後的 :class:`bytes`。"

#: ../../library/base64.rst:251
#, fuzzy
msgid ""
"*foldspaces* is a flag that specifies whether the 'y' short sequence should "
"be accepted as shorthand for 4 consecutive spaces (ASCII 0x20). This feature "
"is not supported by the standard Ascii85 encoding used in PDF and PostScript."
msgstr ""
"*foldspaces* 是一個旗標,指定是否應該將短序列 'y' 視為 4 個連續的空格 (ASCII "
"0x20) 的簡寫。這個功能不受「標準」Ascii85 編碼的支援。"
"0x20) 的簡寫。這個功能不受 PDF 和 PostScript 中使用的標準 Ascii85 編碼的支"
"援。"

#: ../../library/base64.rst:256
msgid ""
Expand Down Expand Up @@ -448,22 +448,20 @@ msgid ""
msgstr ""

#: ../../library/base64.rst:283
#, fuzzy
msgid ""
"Decode the base85-encoded :term:`bytes-like object` or ASCII string *b* and "
"return the decoded :class:`bytes`."
msgstr ""
"解碼經過 Ascii85 編碼的\\ :term:`類位元組物件 <bytes-like object>`\\ 或 "
"ASCII 字串 *b*,並回傳解碼後的 :class:`bytes`。"
"解碼經過 base85 編碼的\\ :term:`類位元組物件 <bytes-like object>`\\ 或 ASCII "
"字串 *b*,並回傳解碼後的 :class:`bytes`。"

#: ../../library/base64.rst:291
#, fuzzy
msgid ""
"Encode the :term:`bytes-like object` *s* using Z85 (as used in ZeroMQ) and "
"return the encoded :class:`bytes`."
msgstr ""
"使用 Base64 對\\ :term:`類位元組物件 <bytes-like object>` *s* 進行編碼並回傳"
"編碼過的 :class:`bytes`。"
"使用 Z85(如用於 ZeroMQ)對\\ :term:`類位元組物件 <bytes-like object>` *s* "
"行編碼,並回傳編碼後的 :class:`bytes`。"

#: ../../library/base64.rst:294
msgid ""
Expand All @@ -474,13 +472,12 @@ msgid ""
msgstr ""

#: ../../library/base64.rst:304
#, fuzzy
msgid ""
"Decode the Z85-encoded :term:`bytes-like object` or ASCII string *s* and "
"return the decoded :class:`bytes`."
msgstr ""
"解碼經過 Ascii85 編碼的\\ :term:`類位元組物件 <bytes-like object>`\\ 或 "
"ASCII 字串 *b*,並回傳解碼後的 :class:`bytes`。"
"解碼經 Z85 編碼的\\ :term:`類位元組物件 <bytes-like object>`\\ 或 ASCII 字串 "
"*s*,並回傳解碼後的 :class:`bytes`。"

#: ../../library/base64.rst:313
msgid "Legacy Interface"
Expand Down
4 changes: 2 additions & 2 deletions library/calendar.po
Original file line number Diff line number Diff line change
Expand Up @@ -661,12 +661,12 @@ msgid "The :mod:`!calendar` module defines the following exceptions:"
msgstr ":mod:`!calendar` 模組定義了以下例外:"

#: ../../library/calendar.rst:547
#, fuzzy
msgid ""
"A subclass of :exc:`ValueError` and :exc:`IndexError`, raised when the given "
"month number is outside of the range 1-12 (inclusive)."
msgstr ""
":exc:`ValueError` 的子類別,當給定的月份數字超出 1-12 範圍(含)時引發。"
":exc:`ValueError` 和 :exc:`IndexError` 的子類別,當給定的月份數字超出 1-12 範"
"圍(含)時引發。"

#: ../../library/calendar.rst:550
msgid ""
Expand Down
3 changes: 1 addition & 2 deletions library/codecs.po
Original file line number Diff line number Diff line change
Expand Up @@ -1616,9 +1616,8 @@ msgid "cp858"
msgstr "cp858"

#: ../../library/codecs.rst:1155
#, fuzzy
msgid "858, IBM00858"
msgstr "858, IBM858"
msgstr "858, IBM00858"

#: ../../library/codecs.rst:1157
msgid "cp860"
Expand Down
5 changes: 2 additions & 3 deletions library/dataclasses.po
Original file line number Diff line number Diff line change
Expand Up @@ -977,14 +977,13 @@ msgid ""
msgstr ""

#: ../../library/dataclasses.rst:499
#, fuzzy
msgid ""
"Return ``True`` if its parameter is a dataclass (including subclasses of a "
"dataclass, but not including :ref:`generic aliases <types-genericalias>`) or "
"an instance of one, otherwise return ``False``."
msgstr ""
"如果它的參數是一個資料類別(包含一個資料類別的子類別)或一個實例則回傳 "
"``True``,否則回傳 ``False``。"
"如果它的參數是一個資料類別(包含一個資料類別的子類別,但不包含\\ :ref:`通用別"
"名 <types-genericalias>`)或一個實例則回傳 ``True``,否則回傳 ``False``。"

#: ../../library/dataclasses.rst:503
#, fuzzy
Expand Down
29 changes: 13 additions & 16 deletions library/gc.po
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,15 @@ 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."
msgstr ""
"啟動垃圾回收。可選的引數 *generation* 可以是一個指明需要回收哪一代垃圾的整數"
"(從 0 到 2)。當 generation 數值無效時,會引發 :exc:`ValueError` 例外。可回"
"收物件與不可回收物件的總和會被回傳。"
"不帶引數執行完整的垃圾回收。可選的引數 *generation* 可以是一個指明需要回"
"收哪一代垃圾的整數(從 0 到 2)。當 generation 數值無效時,會引發 :exc:"
"`ValueError` 例外。可回收物件與不可回收物件的總和會被回傳。"

#: ../../library/gc.rst:48
msgid ""
Expand All @@ -96,9 +95,8 @@ msgid "``generation=1`` performs an increment of collection."
msgstr "``generation=1`` 會執行增量收集。"

#: ../../library/gc.rst:59
#, fuzzy
msgid "``generation=1`` performs collection of the middle generation."
msgstr "``generation=1`` 會執行增量收集。"
msgstr "``generation=1`` 會執行中間代的回收。"

#: ../../library/gc.rst:65
msgid ""
Expand All @@ -114,14 +112,13 @@ msgid "Return the debugging flags currently set."
msgstr "回傳目前設置的除錯旗標。"

#: ../../library/gc.rst:77
#, 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."
msgstr ""
"回傳一個包含回收器正在追蹤的所有物件的 list,除去所回傳的 list。如果 "
"*generation* 不為 ``None``,只回傳以下物件。"
"*generation* 不為 ``None``,只回傳在該代中由回收器追蹤的物件。"

#: ../../library/gc.rst:81
msgid "New *generation* parameter."
Expand Down Expand Up @@ -179,7 +176,6 @@ msgid ""
msgstr "設定垃圾回收閾值(回收頻率)。 將 *threshold0* 設為零會停止回收。"

#: ../../library/gc.rst:116
#, fuzzy
msgid ""
"The GC classifies objects into three generations depending on how many "
"collection sweeps they have survived. New objects are placed in the "
Expand All @@ -199,14 +195,15 @@ msgid ""
"information."
msgstr ""
"垃圾回收器會根據物件在多少次垃圾回收後仍倖存來把所有物件分類為三代。新建物件"
"會被放在最年輕代(第 ``0`` 代)。 如果一個物件在一次垃圾回收後倖存,它會被移"
"入下一個較老代。由於第 ``2`` 代是最老代,這一代的物件在一次垃圾回收後仍會保留"
"原樣。為了確定何時要執行,垃圾回收器會追蹤自上一次回收後物件分配和釋放的數"
"量。當分配數量減去釋放數量的結果大於 *threshold0* 時,垃圾回收就會開始。初始"
"時只有第 ``0`` 代會被檢查。如果自第 ``1`` 代被檢查後第 ``0`` 代已被檢查超過 "
"會被放在最年輕代(第 ``0`` 代)。如果一個物件在一次垃圾回收後倖存,它會被移入"
"下一個較老代。由於第 ``2`` 代是最老代,這一代的物件在一次垃圾回收後仍會保留原"
"。為了確定何時要執行,垃圾回收器會追蹤自上一次回收後物件分配和釋放的數量。"
"當分配數量減去釋放數量的結果大於 *threshold0* 時,垃圾回收就會開始。初始時只"
"有第 ``0`` 代會被檢查。如果自第 ``1`` 代被檢查後第 ``0`` 代已被檢查超過 "
"*threshold1* 次,則第 ``1`` 代也會被檢查。對於第三代來說,情況還會更復雜一"
"些,請參閱 `Collecting the oldest generation <https://devguide.python.org/"
"garbage_collector/#collecting-the-oldest-generation>`_ 來了解詳情。"
"些,請參閱 `Collecting the oldest generation <https://github.com/python/"
"cpython/blob/ff0ef0a54bef26fc507fbf9b7a6009eb7d3f17f5/InternalDocs/"
"garbage_collector.md#collecting-the-oldest-generation>`_ 來了解詳情。"

#: ../../library/gc.rst:130
msgid ""
Expand Down
3 changes: 1 addition & 2 deletions library/html.parser.po
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,6 @@ msgid ""
msgstr "呼叫此方法來處理元素的開始標籤(例如 ``<div id=\"main\">``)。"

#: ../../library/html.parser.rst:140
#, fuzzy
msgid ""
"The *tag* argument is the name of the tag converted to lower case. The "
"*attrs* argument is a list of ``(name, value)`` pairs containing the "
Expand All @@ -246,7 +245,7 @@ msgid ""
msgstr ""
"*tag* 引數是轉換為小寫的標籤名稱。 *attrs* 引數是一個 ``(name, value)`` 對的"
"列表,包含在標籤的 ``<>`` 括號內找到的屬性。 *name* 將被轉成小寫,*value* 中"
"的引號會被刪除,字元和實體參照也會被替換。"
"的引號會被刪除,字元和實體參照也會被替換。對於空屬性,*value* 為 ``None``。"

#: ../../library/html.parser.rst:146
msgid ""
Expand Down
52 changes: 45 additions & 7 deletions library/itertools.po
Original file line number Diff line number Diff line change
Expand Up @@ -1808,7 +1808,6 @@ msgstr ""
"term:`產生器 <generator>`,則能保持高速度。"

#: ../../library/itertools.rst:831
#, fuzzy
msgid ""
"from itertools import (accumulate, batched, chain, combinations, compress,\n"
" count, cycle, filterfalse, groupby, islice, permutations, product,\n"
Expand Down Expand Up @@ -2182,6 +2181,7 @@ msgstr ""
"from collections import Counter, deque\n"
"from contextlib import suppress\n"
"from functools import reduce\n"
"from heapq import heappush, heappushpop, heappush_max, heappushpop_max\n"
"from math import comb, isqrt, prod, sumprod\n"
"from operator import getitem, is_not, itemgetter, mul, neg, truediv\n"
"\n"
Expand All @@ -2197,11 +2197,6 @@ msgstr ""
" # prepend(1, [2, 3, 4]) → 1 2 3 4\n"
" return chain([value], iterable)\n"
"\n"
"def running_mean(iterable):\n"
" \"產生到目前為止所有值的平均值。\"\n"
" # running_mean([8.5, 9.5, 7.5, 6.5]) → 8.5 9.0 8.5 8.0\n"
" return map(truediv, accumulate(iterable), count(1))\n"
"\n"
"def repeatfunc(function, times=None, *args):\n"
" \"重複呼叫一個帶指定引數的函式。\"\n"
" if times is None:\n"
Expand Down Expand Up @@ -2497,4 +2492,47 @@ msgstr ""
" # totient(12) → 4 因為 len([1, 5, 7, 11]) == 4\n"
" for prime in set(factor(n)):\n"
" n -= n // prime\n"
" return n"
" return n\n"
"\n"
"\n"
"# ==== 執行統計 ====\n"
"\n"
"def running_mean(iterable):\n"
" \"到目前為止所見值的平均值。\"\n"
" # running_mean([37, 33, 38, 28]) → 37 35 36 34\n"
" return map(truediv, accumulate(iterable), count(1))\n"
"\n"
"def running_min(iterable):\n"
" \"到目前為止所見值中最小的。\"\n"
" # running_min([37, 33, 38, 28]) → 37 33 33 28\n"
" return accumulate(iterable, func=min)\n"
"\n"
"def running_max(iterable):\n"
" \"到目前為止所見值中最大的。\"\n"
" # running_max([37, 33, 38, 28]) → 37 37 38 38\n"
" return accumulate(iterable, func=max)\n"
"\n"
"def running_median(iterable):\n"
" \"到目前為止所見值的中位數。\"\n"
" # running_median([37, 33, 38, 28]) → 37 35 37 35\n"
" read = iter(iterable).__next__\n"
" lo = [] # max-heap\n"
" hi = [] # min-heap the same size as or one smaller than lo\n"
Comment thread
mattwang44 marked this conversation as resolved.
" with suppress(StopIteration):\n"
" while True:\n"
" heappush_max(lo, heappushpop(hi, read()))\n"
" yield lo[0]\n"
" heappush(hi, heappushpop_max(lo, read()))\n"
" yield (lo[0] + hi[0]) / 2\n"
"\n"
"def running_statistics(iterable):\n"
" \"到目前為止所見值的彙總統計。\"\n"
" # 產生元組:(大小, 最小值, 中位數, 最大值, 平均值)\n"
" t0, t1, t2, t3 = tee(iterable, 4)\n"
" return zip(\n"
" count(1),\n"
" running_min(t0),\n"
" running_median(t1),\n"
" running_max(t2),\n"
" running_mean(t3),\n"
" )"
Loading
Loading