@@ -782,17 +782,21 @@ msgid ""
782782"in the constructor, and return the reconstituted object hierarchy specified "
783783"therein. Bytes past the pickled representation of the object are ignored."
784784msgstr ""
785+ "開啟先前被傳入建構子的檔案,從中讀取一個被 pickle 封裝的物件,並回傳重建完成"
786+ "的物件階層。超過 pickle 表示範圍的位元組會被忽略。"
785787
786788#: ../../library/pickle.rst:441
787789msgid "Raise an :exc:`UnpicklingError` by default."
788- msgstr ""
790+ msgstr "預設會拋出 :exc:`UnpicklingError` 例外。 "
789791
790792#: ../../library/pickle.rst:443
791793msgid ""
792794"If defined, :meth:`persistent_load` should return the object specified by "
793795"the persistent ID *pid*. If an invalid persistent ID is encountered, an :"
794796"exc:`UnpicklingError` should be raised."
795797msgstr ""
798+ "若有定義 :meth:`persistent_load`,則其將回傳符合持久化識別碼 `pid` 的物件。如"
799+ "果遭遇了無效的持久化識別碼,則會引發 :exc:`UnpicklingError`。"
796800
797801#: ../../library/pickle.rst:451
798802msgid ""
@@ -801,13 +805,18 @@ msgid ""
801805"unlike its name suggests, :meth:`find_class` is also used for finding "
802806"functions."
803807msgstr ""
808+ "如有需要將引入 *module* ,並從中返回名為 *name* 的物件,這裡的 *module* 和 "
809+ "*name* 引數接受的輸入是 :class:`str` 物件。注意,雖然名稱上看起來不像,但 :"
810+ "meth:`find_class` 亦可被用於尋找其他函式。"
804811
805812#: ../../library/pickle.rst:456
806813msgid ""
807814"Subclasses may override this to gain control over what type of objects and "
808815"how they can be loaded, potentially reducing security risks. Refer to :ref:"
809816"`pickle-restrict` for details."
810817msgstr ""
818+ "子類別可以覆寫此方法以控制可以載入哪些類型的物件、以及如何載入它們,從而潛在"
819+ "地降低安全性風險。詳情請參考 :ref:`pickle-restrict`。"
811820
812821#: ../../library/pickle.rst:460
813822msgid ""
@@ -817,81 +826,104 @@ msgstr ""
817826"引發一個附帶引數 ``module``、``name`` 的\\ :ref:`稽核事件 <auditing>` "
818827"``pickle.find_class``。"
819828
829+ # SkyLull: [T]
830+ # 參見 #729
831+ # wrapper -> 包裝器
820832#: ../../library/pickle.rst:464
821833msgid ""
822834"A wrapper for a buffer representing picklable data. *buffer* must be a :ref:"
823835"`buffer-providing <bufferobjects>` object, such as a :term:`bytes-like "
824836"object` or a N-dimensional array."
825837msgstr ""
838+ "一個表示了含有可封裝數據緩衝區的包裝函數(wrapper function)。*buffer* 必須是"
839+ "一個 :ref:`提供緩衝區 <bufferobjects>` 的物件,例如一個 :term:`類位元組物件"
840+ "(bytes-like object)` 或 N 維陣列。"
826841
827842#: ../../library/pickle.rst:468
828843msgid ""
829844":class:`PickleBuffer` is itself a buffer provider, therefore it is possible "
830845"to pass it to other APIs expecting a buffer-providing object, such as :class:"
831846"`memoryview`."
832847msgstr ""
848+ ":class:`PickleBuffer` 本身就是一個提供緩衝區的物件,所以是能夠將其提供給其它"
849+ "「預期收到含有緩衝物件的 API」的,比如 :class:`memoryview`。"
833850
834851#: ../../library/pickle.rst:472
835852msgid ""
836853":class:`PickleBuffer` objects can only be serialized using pickle protocol 5 "
837854"or higher. They are eligible for :ref:`out-of-band serialization <pickle-"
838855"oob>`."
839856msgstr ""
857+ ":class:`PickleBuffer` 物件僅能由 5 版或以上的 pickle 協定進行封裝。該物件亦能"
858+ "被作為帶外資料來進行:ref:`帶外資料序列化 <pickle-oob>`"
840859
860+ # SkyLull: [T] oh boy... 好多術語...
861+ # format B: https://learn.microsoft.com/zh-tw/dotnet/standard/base-types/standard-numeric-format-strings#BFormatString
862+ # C-contiguous, Fortran-contiguous: https://stackoverflow.com/a/26999092
841863#: ../../library/pickle.rst:480
842864msgid ""
843865"Return a :class:`memoryview` of the memory area underlying this buffer. The "
844866"returned object is a one-dimensional, C-contiguous memoryview with format "
845867"``B`` (unsigned bytes). :exc:`BufferError` is raised if the buffer is "
846868"neither C- nor Fortran-contiguous."
847869msgstr ""
870+ "返回此緩衝區底層記憶體區域的 :class:`memoryview`。被返回的物件是一個(在 C 語"
871+ "言的 formatter 格式中)以 ``B`` (unsigned bytes) 二進位格式儲存、一維且列連續"
872+ "(C-contiguous)的 memoryview。如果緩衝區既不是列連續(C-contiguous)也不是行"
873+ "連續(Fortran-contiguous)的,則會引發 :exc:`BufferError`。"
848874
849875#: ../../library/pickle.rst:487
850876msgid "Release the underlying buffer exposed by the PickleBuffer object."
851- msgstr ""
877+ msgstr "釋放 PickleBuffer 物件現正曝光中的緩衝區。 "
852878
853879#: ../../library/pickle.rst:493
854880msgid "What can be pickled and unpickled?"
855- msgstr ""
881+ msgstr "哪些物件能或不能被封裝、拆封? "
856882
857883#: ../../library/pickle.rst:495
858884msgid "The following types can be pickled:"
859- msgstr ""
885+ msgstr "下列型別可以被封裝: "
860886
861887#: ../../library/pickle.rst:497
862888msgid ""
863889"built-in constants (``None``, ``True``, ``False``, ``Ellipsis``, and :data:"
864890"`NotImplemented`);"
865891msgstr ""
892+ "內建常數(``None``、``True``、``False``、``Ellipsis`` 和 :data:"
893+ "`NotImplemented`);"
866894
867895#: ../../library/pickle.rst:500
868896msgid "integers, floating-point numbers, complex numbers;"
869- msgstr ""
897+ msgstr "整數、浮點數和複數; "
870898
871899#: ../../library/pickle.rst:502
872900msgid "strings, bytes, bytearrays;"
873- msgstr ""
901+ msgstr "字串、位元組物件、位元組陣列; "
874902
875903#: ../../library/pickle.rst:504
876904msgid ""
877905"tuples, lists, sets, and dictionaries containing only picklable objects;"
878- msgstr ""
906+ msgstr "元組(tuple)、串列(list)、集合(set)和僅含有可封裝物件的字典; "
879907
880908#: ../../library/pickle.rst:506
881909msgid ""
882910"functions (built-in and user-defined) accessible from the top level of a "
883911"module (using :keyword:`def`, not :keyword:`lambda`);"
884912msgstr ""
913+ "在模組最表面的層級就能被存取的函式(內建或自訂的皆可,不過僅限使用 :keyword:"
914+ "`def` 定義的函式,:keyword:`lambda` 函式不適用);"
885915
886916#: ../../library/pickle.rst:509
887917msgid "classes accessible from the top level of a module;"
888- msgstr ""
918+ msgstr "在模組最表面的層級就能被存取的類別; "
889919
890920#: ../../library/pickle.rst:511
891921msgid ""
892922"instances of such classes whose the result of calling :meth:`~object."
893923"__getstate__` is picklable (see section :ref:`pickle-inst` for details)."
894924msgstr ""
925+ "實例,只要在呼叫了 :meth:`~object.__getstate__` 後其回傳值全都是可封裝物件。"
926+ "(詳情請參閱 :ref:`pickle-inst`)。"
895927
896928#: ../../library/pickle.rst:514
897929msgid ""
@@ -902,7 +934,14 @@ msgid ""
902934"`RecursionError` will be raised in this case. You can carefully raise this "
903935"limit with :func:`sys.setrecursionlimit`."
904936msgstr ""
937+ "嘗試封裝無法封裝的物件會引發 :exc:`PicklingError` 例外;注意當這種情況發生"
938+ "時,可能已經有未知數量的位元組已被寫入到檔案。嘗試封裝深度遞迴的資料結構可能"
939+ "會導致其超出最大遞迴深度,在這種情況下會引發 :exc:`RecursionError` 例外。你可"
940+ "以(小心地)使用 :func:`sys.setrecursionlimit` 來提高此上限。"
905941
942+ # SkyLull: [T]
943+ # 請見官方術語表
944+ # qualified name -> 限定名稱
906945#: ../../library/pickle.rst:521
907946msgid ""
908947"Note that functions (built-in and user-defined) are pickled by fully :term:"
@@ -913,6 +952,11 @@ msgid ""
913952"environment, and the module must contain the named object, otherwise an "
914953"exception will be raised. [#]_"
915954msgstr ""
955+ "請注意,函式(內建及自訂兩者皆是)是依據完整的 :term:`限定名稱 <qualified "
956+ "name>` 來封裝,而非依其值。[#]_ 這意味著封裝時只有函式名稱、所屬的模組和所屬"
957+ "的類別名稱會被封裝。函式本身的程式碼及其附帶的任何屬性均不會被封裝。因此,在"
958+ "拆封該物件的環境中,定義此函式的模組必須可被引入,且該模組必須包含具此命名之"
959+ "物件,否則將引發例外。 [#]_"
916960
917961#: ../../library/pickle.rst:528
918962msgid ""
@@ -921,12 +965,15 @@ msgid ""
921965"class's code or data is pickled, so in the following example the class "
922966"attribute ``attr`` is not restored in the unpickling environment::"
923967msgstr ""
968+ "同樣情況,類別是依照其完整限定名稱來進行封裝,因此在進行拆封的環境中會具有同"
969+ "上的限制。類別中的程式碼或資料皆不會被封裝,因此在以下範例中,注意到類別屬性 "
970+ "``attr`` 在拆封的環境中不會被還原::"
924971
925972#: ../../library/pickle.rst:538
926973msgid ""
927974"These restrictions are why picklable functions and classes must be defined "
928975"at the top level of a module."
929- msgstr ""
976+ msgstr "這些限制就是可封裝的函式和類別必須被定義在模組頂層的原因。 "
930977
931978#: ../../library/pickle.rst:541
932979msgid ""
@@ -939,6 +986,11 @@ msgid ""
939986"that suitable conversions can be made by the class's :meth:`~object."
940987"__setstate__` method."
941988msgstr ""
989+ "同樣地,當類別實例被封裝時,它所屬類別具有的程式碼和資料不會被一起封裝。只有"
990+ "實例資料本身會被封裝。這是有意而為的,因為如此你才可以在類別中修正錯誤或新增"
991+ "其他方法,且於此同時仍能夠載入使用較早期版本的類別所建立的物件實例。如果您預"
992+ "計將有長期存在的物件、且該物件將經歷許多版本的更替,你可以在物件中存放一個版"
993+ "本號,以便未來能透過 :meth:`~object.__setstate__` 方法來進行適當的版本轉換。"
942994
943995#: ../../library/pickle.rst:553
944996msgid "Pickling Class Instances"
0 commit comments