@@ -782,17 +782,21 @@ msgid ""
782
782
"in the constructor, and return the reconstituted object hierarchy specified "
783
783
"therein. Bytes past the pickled representation of the object are ignored."
784
784
msgstr ""
785
+ "開啟先前被傳入建構子的檔案,從中讀取一個被 pickle 封裝的物件,並回傳重建完成"
786
+ "的物件階層。超過 pickle 表示範圍的位元組會被忽略。"
785
787
786
788
#: ../../library/pickle.rst:441
787
789
msgid "Raise an :exc:`UnpicklingError` by default."
788
- msgstr ""
790
+ msgstr "預設會拋出 :exc:`UnpicklingError` 例外。 "
789
791
790
792
#: ../../library/pickle.rst:443
791
793
msgid ""
792
794
"If defined, :meth:`persistent_load` should return the object specified by "
793
795
"the persistent ID *pid*. If an invalid persistent ID is encountered, an :"
794
796
"exc:`UnpicklingError` should be raised."
795
797
msgstr ""
798
+ "若有定義 :meth:`persistent_load`,則其將回傳符合持久化識別碼 `pid` 的物件。如"
799
+ "果遭遇了無效的持久化識別碼,則會引發 :exc:`UnpicklingError`。"
796
800
797
801
#: ../../library/pickle.rst:451
798
802
msgid ""
@@ -801,13 +805,18 @@ msgid ""
801
805
"unlike its name suggests, :meth:`find_class` is also used for finding "
802
806
"functions."
803
807
msgstr ""
808
+ "如有需要將引入 *module* ,並從中返回名為 *name* 的物件,這裡的 *module* 和 "
809
+ "*name* 引數接受的輸入是 :class:`str` 物件。注意,雖然名稱上看起來不像,但 :"
810
+ "meth:`find_class` 亦可被用於尋找其他函式。"
804
811
805
812
#: ../../library/pickle.rst:456
806
813
msgid ""
807
814
"Subclasses may override this to gain control over what type of objects and "
808
815
"how they can be loaded, potentially reducing security risks. Refer to :ref:"
809
816
"`pickle-restrict` for details."
810
817
msgstr ""
818
+ "子類別可以覆寫此方法以控制可以載入哪些類型的物件、以及如何載入它們,從而潛在"
819
+ "地降低安全性風險。詳情請參考 :ref:`pickle-restrict`。"
811
820
812
821
#: ../../library/pickle.rst:460
813
822
msgid ""
@@ -817,81 +826,104 @@ msgstr ""
817
826
"引發一個附帶引數 ``module``、``name`` 的\\ :ref:`稽核事件 <auditing>` "
818
827
"``pickle.find_class``。"
819
828
829
+ # SkyLull: [T]
830
+ # 參見 #729
831
+ # wrapper -> 包裝器
820
832
#: ../../library/pickle.rst:464
821
833
msgid ""
822
834
"A wrapper for a buffer representing picklable data. *buffer* must be a :ref:"
823
835
"`buffer-providing <bufferobjects>` object, such as a :term:`bytes-like "
824
836
"object` or a N-dimensional array."
825
837
msgstr ""
838
+ "一個表示了含有可封裝數據緩衝區的包裝函數(wrapper function)。*buffer* 必須是"
839
+ "一個 :ref:`提供緩衝區 <bufferobjects>` 的物件,例如一個 :term:`類位元組物件"
840
+ "(bytes-like object)` 或 N 維陣列。"
826
841
827
842
#: ../../library/pickle.rst:468
828
843
msgid ""
829
844
":class:`PickleBuffer` is itself a buffer provider, therefore it is possible "
830
845
"to pass it to other APIs expecting a buffer-providing object, such as :class:"
831
846
"`memoryview`."
832
847
msgstr ""
848
+ ":class:`PickleBuffer` 本身就是一個提供緩衝區的物件,所以是能夠將其提供給其它"
849
+ "「預期收到含有緩衝物件的 API」的,比如 :class:`memoryview`。"
833
850
834
851
#: ../../library/pickle.rst:472
835
852
msgid ""
836
853
":class:`PickleBuffer` objects can only be serialized using pickle protocol 5 "
837
854
"or higher. They are eligible for :ref:`out-of-band serialization <pickle-"
838
855
"oob>`."
839
856
msgstr ""
857
+ ":class:`PickleBuffer` 物件僅能由 5 版或以上的 pickle 協定進行封裝。該物件亦能"
858
+ "被作為帶外資料來進行:ref:`帶外資料序列化 <pickle-oob>`"
840
859
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
841
863
#: ../../library/pickle.rst:480
842
864
msgid ""
843
865
"Return a :class:`memoryview` of the memory area underlying this buffer. The "
844
866
"returned object is a one-dimensional, C-contiguous memoryview with format "
845
867
"``B`` (unsigned bytes). :exc:`BufferError` is raised if the buffer is "
846
868
"neither C- nor Fortran-contiguous."
847
869
msgstr ""
870
+ "返回此緩衝區底層記憶體區域的 :class:`memoryview`。被返回的物件是一個(在 C 語"
871
+ "言的 formatter 格式中)以 ``B`` (unsigned bytes) 二進位格式儲存、一維且列連續"
872
+ "(C-contiguous)的 memoryview。如果緩衝區既不是列連續(C-contiguous)也不是行"
873
+ "連續(Fortran-contiguous)的,則會引發 :exc:`BufferError`。"
848
874
849
875
#: ../../library/pickle.rst:487
850
876
msgid "Release the underlying buffer exposed by the PickleBuffer object."
851
- msgstr ""
877
+ msgstr "釋放 PickleBuffer 物件現正曝光中的緩衝區。 "
852
878
853
879
#: ../../library/pickle.rst:493
854
880
msgid "What can be pickled and unpickled?"
855
- msgstr ""
881
+ msgstr "哪些物件能或不能被封裝、拆封? "
856
882
857
883
#: ../../library/pickle.rst:495
858
884
msgid "The following types can be pickled:"
859
- msgstr ""
885
+ msgstr "下列型別可以被封裝: "
860
886
861
887
#: ../../library/pickle.rst:497
862
888
msgid ""
863
889
"built-in constants (``None``, ``True``, ``False``, ``Ellipsis``, and :data:"
864
890
"`NotImplemented`);"
865
891
msgstr ""
892
+ "內建常數(``None``、``True``、``False``、``Ellipsis`` 和 :data:"
893
+ "`NotImplemented`);"
866
894
867
895
#: ../../library/pickle.rst:500
868
896
msgid "integers, floating-point numbers, complex numbers;"
869
- msgstr ""
897
+ msgstr "整數、浮點數和複數; "
870
898
871
899
#: ../../library/pickle.rst:502
872
900
msgid "strings, bytes, bytearrays;"
873
- msgstr ""
901
+ msgstr "字串、位元組物件、位元組陣列; "
874
902
875
903
#: ../../library/pickle.rst:504
876
904
msgid ""
877
905
"tuples, lists, sets, and dictionaries containing only picklable objects;"
878
- msgstr ""
906
+ msgstr "元組(tuple)、串列(list)、集合(set)和僅含有可封裝物件的字典; "
879
907
880
908
#: ../../library/pickle.rst:506
881
909
msgid ""
882
910
"functions (built-in and user-defined) accessible from the top level of a "
883
911
"module (using :keyword:`def`, not :keyword:`lambda`);"
884
912
msgstr ""
913
+ "在模組最表面的層級就能被存取的函式(內建或自訂的皆可,不過僅限使用 :keyword:"
914
+ "`def` 定義的函式,:keyword:`lambda` 函式不適用);"
885
915
886
916
#: ../../library/pickle.rst:509
887
917
msgid "classes accessible from the top level of a module;"
888
- msgstr ""
918
+ msgstr "在模組最表面的層級就能被存取的類別; "
889
919
890
920
#: ../../library/pickle.rst:511
891
921
msgid ""
892
922
"instances of such classes whose the result of calling :meth:`~object."
893
923
"__getstate__` is picklable (see section :ref:`pickle-inst` for details)."
894
924
msgstr ""
925
+ "實例,只要在呼叫了 :meth:`~object.__getstate__` 後其回傳值全都是可封裝物件。"
926
+ "(詳情請參閱 :ref:`pickle-inst`)。"
895
927
896
928
#: ../../library/pickle.rst:514
897
929
msgid ""
@@ -902,7 +934,14 @@ msgid ""
902
934
"`RecursionError` will be raised in this case. You can carefully raise this "
903
935
"limit with :func:`sys.setrecursionlimit`."
904
936
msgstr ""
937
+ "嘗試封裝無法封裝的物件會引發 :exc:`PicklingError` 例外;注意當這種情況發生"
938
+ "時,可能已經有未知數量的位元組已被寫入到檔案。嘗試封裝深度遞迴的資料結構可能"
939
+ "會導致其超出最大遞迴深度,在這種情況下會引發 :exc:`RecursionError` 例外。你可"
940
+ "以(小心地)使用 :func:`sys.setrecursionlimit` 來提高此上限。"
905
941
942
+ # SkyLull: [T]
943
+ # 請見官方術語表
944
+ # qualified name -> 限定名稱
906
945
#: ../../library/pickle.rst:521
907
946
msgid ""
908
947
"Note that functions (built-in and user-defined) are pickled by fully :term:"
@@ -913,6 +952,11 @@ msgid ""
913
952
"environment, and the module must contain the named object, otherwise an "
914
953
"exception will be raised. [#]_"
915
954
msgstr ""
955
+ "請注意,函式(內建及自訂兩者皆是)是依據完整的 :term:`限定名稱 <qualified "
956
+ "name>` 來封裝,而非依其值。[#]_ 這意味著封裝時只有函式名稱、所屬的模組和所屬"
957
+ "的類別名稱會被封裝。函式本身的程式碼及其附帶的任何屬性均不會被封裝。因此,在"
958
+ "拆封該物件的環境中,定義此函式的模組必須可被引入,且該模組必須包含具此命名之"
959
+ "物件,否則將引發例外。 [#]_"
916
960
917
961
#: ../../library/pickle.rst:528
918
962
msgid ""
@@ -921,12 +965,15 @@ msgid ""
921
965
"class's code or data is pickled, so in the following example the class "
922
966
"attribute ``attr`` is not restored in the unpickling environment::"
923
967
msgstr ""
968
+ "同樣情況,類別是依照其完整限定名稱來進行封裝,因此在進行拆封的環境中會具有同"
969
+ "上的限制。類別中的程式碼或資料皆不會被封裝,因此在以下範例中,注意到類別屬性 "
970
+ "``attr`` 在拆封的環境中不會被還原::"
924
971
925
972
#: ../../library/pickle.rst:538
926
973
msgid ""
927
974
"These restrictions are why picklable functions and classes must be defined "
928
975
"at the top level of a module."
929
- msgstr ""
976
+ msgstr "這些限制就是可封裝的函式和類別必須被定義在模組頂層的原因。 "
930
977
931
978
#: ../../library/pickle.rst:541
932
979
msgid ""
@@ -939,6 +986,11 @@ msgid ""
939
986
"that suitable conversions can be made by the class's :meth:`~object."
940
987
"__setstate__` method."
941
988
msgstr ""
989
+ "同樣地,當類別實例被封裝時,它所屬類別具有的程式碼和資料不會被一起封裝。只有"
990
+ "實例資料本身會被封裝。這是有意而為的,因為如此你才可以在類別中修正錯誤或新增"
991
+ "其他方法,且於此同時仍能夠載入使用較早期版本的類別所建立的物件實例。如果您預"
992
+ "計將有長期存在的物件、且該物件將經歷許多版本的更替,你可以在物件中存放一個版"
993
+ "本號,以便未來能透過 :meth:`~object.__setstate__` 方法來進行適當的版本轉換。"
942
994
943
995
#: ../../library/pickle.rst:553
944
996
msgid "Pickling Class Instances"
0 commit comments