Expand Up @@ -3,24 +3,28 @@ # This file is distributed under the same license as the Python package. # # Translators: # Adrian Liaw <adrianliaw2000@gmail.com>, 2018 # Matt Wang <mattwang44@gmail.com>, 2021 # msgid "" msgstr "" "Project-Id-Version: Python 3.10\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-09-13 00:11+0000\n" "PO-Revision-Date:2018-05-23 16:05+0000 \n" "Last-Translator:Adrian Liaw <adrianliaw2000 @gmail.com>\n" "PO-Revision-Date:2021-12-15 12:53+0800 \n" "Last-Translator:Matt Wang <mattwang44 @gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" "Language: zh_TW\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" "X-Generator: Poedit 3.0.1\n" #: ../../library/marshal.rst:2 msgid ":mod:`marshal` --- Internal Python object serialization" msgstr "" msgstr ":mod:`marshal` --- 内部 Python 物件序列化 " #: ../../library/marshal.rst:10 msgid "" Expand All @@ -31,6 +35,10 @@ msgid "" "are undocumented on purpose; it may change between Python versions (although " "it rarely does). [#]_" msgstr "" "此 module(模組)包含一個能以二進位制格式來讀寫 Python 值的函式。這種格式是 " "Python 專屬但獨立於機器架構的(例如,你可以在一臺 PC 上寫入某個 Python 值,再" "將檔案傳到一臺 Sun 上並在那裡讀取它)。這種格式的細節是有意地不在文件上說明" "的;它可能在不同 Python 版本中被改變(雖然這種情況極少發生)。\\ [#]_" #: ../../library/marshal.rst:21 msgid "" Expand All @@ -45,13 +53,22 @@ msgid "" "guaranteed, and pickle supports a substantially wider range of objects than " "marshal." msgstr "" "這不是一個通用「持續性 (persistence)」module 。關於通用持續性以及透過 RPC 呼" "叫傳遞 Python 物件,請參閱 :mod:`pickle` 和 :mod:`shelve` 等 module 。\\ :" "mod:`marshal` module 主要是為了支援用來讀寫「偽編譯 (pseudo-compiled)」 :" "file:`.pyc` 檔案的 Python module。因此,Python 維護者保留了在必要時以不向後相" "容的方式修改 marshal 格式的權利。如果你要序列化和反序列化 Python 物件,請改" "用 :mod:`pickle` module -- 其執行效率相當、有保證版本獨立性,且實質上 " "pickle 還支援比 marshal 更多樣的物件。" #: ../../library/marshal.rst:33 msgid "" "The :mod:`marshal` module is not intended to be secure against erroneous or " "maliciously constructed data. Never unmarshal data received from an " "untrusted or unauthenticated source." msgstr "" ":mod:`marshal` module 對於錯誤或惡意構建的資料來說是不安全的。永遠不要 " "unmarshal 來自不受信任的或來源未經驗證的資料。" #: ../../library/marshal.rst:39 msgid "" Expand All @@ -67,22 +84,34 @@ msgid "" "*version* lower than 3, recursive lists, sets and dictionaries cannot be " "written (see below)." msgstr "" "不是所有 Python 物件型別都有支援;一般來說,此 module 只能寫入和讀取不依賴於" "特定 Python 調用 (invocation) 的物件。下列型別是有支援的:布林 (boolean)、整" "數、浮點數 (floating point number)、複數、字串、位元組串 (bytes)、位元組陣列 " "(bytearray)、元組 (tuple)、list、集合 (set)、凍結集合 (frozenset)、" "dictionary 和程式碼物件,需要了解的一點是元組、list、集合、凍結集合和 " "dictionary 只在其所包含的值也屬於這些型別時才會支援。單例 (singleton) 物件 :" "const:`None`\\ 、\\ :const:`Ellipsis` 和 :exc:`StopIteration` 也可以被 " "marshal 和 unmarshal。對於 *version* 低於 3 的格式,遞迴 list、集合和 " "dictionary 無法被寫入(見下文)。" #: ../../library/marshal.rst:51 msgid "" "There are functions that read/write files as well as functions operating on " "bytes-like objects." msgstr "" "有些函式可以讀/寫檔案,還有些函式可以操作類位元組串物件 (bytes-like object)。" #: ../../library/marshal.rst:54 msgid "The module defines these functions:" msgstr "" msgstr "這個 module 定義了以下函式: " #: ../../library/marshal.rst:59 msgid "" "Write the value on the open file. The value must be a supported type. The " "file must be a writeable :term:`binary file`." msgstr "" "將值寫入被開啟的檔案。值必須為受支援的型別,檔案必須為可寫入的 :term:`binary " "file`。" #: ../../library/marshal.rst:62 msgid "" Expand All @@ -91,18 +120,23 @@ msgid "" "written to the file. The object will not be properly read back by :func:" "`load`." msgstr "" "如果值具有(或其所包含的物件具有)不支援的型別,則會引發 :exc:`ValueError` 例" "外 --- 但是垃圾資料 (garbage data) 也將寫入檔案,物件也無法正確地透過 :func:" "`load` 重新讀取。" #: ../../library/marshal.rst:66 msgid "" "The *version* argument indicates the data format that ``dump`` should use " "(see below)." msgstr "" msgstr "*version* 引數指明 ``dump`` 應該使用的資料格式(見下文)。 " #: ../../library/marshal.rst:69 ../../library/marshal.rst:101 msgid "" "Raises an :ref:`auditing event <auditing>` ``marshal.dumps`` with arguments " "``value``, ``version``." msgstr "" "引發一個附帶引數 ``value`` 與 ``version`` 的\\ :ref:`稽核事件 (auditing " "event) <auditing>` ``marshal.dumps``\\ 。" #: ../../library/marshal.rst:74 msgid "" Expand All @@ -111,60 +145,78 @@ msgid "" "format), raise :exc:`EOFError`, :exc:`ValueError` or :exc:`TypeError`. The " "file must be a readable :term:`binary file`." msgstr "" "從開啟的檔案讀取一個值並回傳。如果讀不到有效的值(例如,由於資料為不同 " "Python 版本的不相容 marshal 格式),則會引發 :exc:`EOFError`\\ 、\\ :exc:" "`ValueError` 或 :exc:`TypeError`。檔案必須為可讀取的 :term:`binary file`\\ 。" #: ../../library/marshal.rst:79 msgid "" "Raises an :ref:`auditing event <auditing>` ``marshal.load`` with no " "arguments." msgstr "" "引發一個沒有附帶引數的\\ :ref:`稽核事件 <auditing>` ``marshal.load``\\ 。" #: ../../library/marshal.rst:83 msgid "" "If an object containing an unsupported type was marshalled with :func:" "`dump`, :func:`load` will substitute ``None`` for the unmarshallable type." msgstr "" "如果透過 :func:`dump` marshal 了一個包含不支援型別的物件,\\ :func:`load` 會" "將不可 marshal 的型別替換為 ``None``\\ 。" #: ../../library/marshal.rst:88 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." msgstr "" "使用此呼叫為每個程式碼物件引發一個 ``code.__new__`` 稽核事件。現在它會為整個" "載入操作引發單個 ``marshal.load`` 事件。" #: ../../library/marshal.rst:94 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` " "exception if value has (or contains an object that has) an unsupported type." msgstr "" "回傳將透過 ``dump(value, file)`` 來被寫入一個檔案的位元組串物件,其值必須是有" "支援的型別,如果值(或其包含的任一物件)為不支援的型別則會引發 :exc:" "`ValueError`\\ 。" #: ../../library/marshal.rst:98 msgid "" "The *version* argument indicates the data format that ``dumps`` should use " "(see below)." msgstr "" msgstr "*version* 引數指明 ``dumps`` 應當使用的資料型別(見下文)。 " #: ../../library/marshal.rst:106 msgid "" "Convert the :term:`bytes-like object` to a value. If no valid value is " "found, raise :exc:`EOFError`, :exc:`ValueError` or :exc:`TypeError`. Extra " "bytes in the input are ignored." msgstr "" "將 :term:`bytes-like object` 轉換為一個值。如果找不到有效的值,則會引發 :exc:" "`EOFError`\\ 、\\ :exc:`ValueError` 或 :exc:`TypeError`\\ 。輸入中額外的位元" "組串會被忽略。" #: ../../library/marshal.rst:110 msgid "" "Raises an :ref:`auditing event <auditing>` ``marshal.loads`` with argument " "``bytes``." msgstr "" "引發一個附帶引數 ``bytes`` 的\\ :ref:`稽核事件 <auditing>` ``marshal.loads``" "\\ 。" #: ../../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.loads`` event for the entire load operation." msgstr "" "使用此呼叫為每個程式碼物件引發一個 ``code.__new__`` 稽核事件。現在它會為整個" "載入操作引發單個 ``marshal.loads`` 事件。" #: ../../library/marshal.rst:118 msgid "In addition, the following constants are defined:" msgstr "" msgstr "此外,還定義了以下常數: " #: ../../library/marshal.rst:122 msgid "" Expand All @@ -173,6 +225,9 @@ msgid "" "for floating point numbers. Version 3 adds support for object instancing and " "recursion. The current version is 4." msgstr "" "表示 module 所使用的格式。第 0 版為歷史格式,第 1 版共享了駐留字串 (interned " "string),第 2 版對浮點數使用二進位制格式。第 3 版添加了對於物件實例化和遞迴的" "支援。目前使用的是第 4 版。" #: ../../library/marshal.rst:130 msgid "Footnotes" Expand All @@ -186,3 +241,7 @@ msgid "" "marshal\" means to convert some data from internal to external form (in an " "RPC buffer for instance) and \"unmarshalling\" for the reverse process." msgstr "" "此 module 的名稱來源於 Modula-3 (及其他語言) 的設計者所使用的術語,他們使用 " "\"marshal\" 來表示自包含 (self-contained) 形式資料的傳輸。嚴格來說,將資料從" "內部形式轉換為外部形式 (例如用於 RPC 緩衝區) 稱為 \"marshal\",而其反向過程則" "稱為 \"unmarshal\"。"