1
- # SOME DESCRIPTIVE TITLE.
2
- # Copyright (C) 2001-2022, Python Software Foundation
1
+ # Copyright (C) 2001-2023, Python Software Foundation
3
2
# This file is distributed under the same license as the Python package.
4
- # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
3
#
4
+ # Translators:
5
+ # Matt Wang <mattwang44@gmail.com>, 2023
6
6
msgid ""
7
7
msgstr ""
8
8
"Project-Id-Version : Python 3.12\n "
9
9
"Report-Msgid-Bugs-To : \n "
10
10
"POT-Creation-Date : 2023-07-26 00:03+0000\n "
11
- "PO-Revision-Date : YEAR-MO-DA HO:MI+ZONE \n "
12
- "Last-Translator : FULL NAME <EMAIL@ADDRESS >\n "
11
+ "PO-Revision-Date : 2023-08-16 00:03+0800 \n "
12
+ "Last-Translator : Matt Wang <mattwang44@gmail.com >\n "
13
13
"Language-Team : Chinese - TAIWAN (https://github.com/python/python-docs-zh- "
14
14
"tw)\n "
15
15
"Language : zh_TW\n "
@@ -22,6 +22,7 @@ msgid ""
22
22
":mod:`multiprocessing.shared_memory` --- Shared memory for direct access "
23
23
"across processes"
24
24
msgstr ""
25
+ ":mod:`multiprocessing.shared_memory` --- 對於共享記憶體的跨行程直接存取"
25
26
26
27
#: ../../library/multiprocessing.shared_memory.rst:7
27
28
msgid "**Source code:** :source:`Lib/multiprocessing/shared_memory.py`"
@@ -37,6 +38,11 @@ msgid ""
37
38
"`SharedMemoryManager`, is also provided in the ``multiprocessing.managers`` "
38
39
"module."
39
40
msgstr ""
41
+ "該模組提供了一個 :class:`SharedMemory` 類別,用於分配和管理由多核心或對稱多處"
42
+ "理器 (symmetric multiprocessor, SMP) 機器上的一個或多個行程存取的共享記憶體。"
43
+ "為了協助共享記憶體的生命週期管理,特別是跨不同行程的管理,``multiprocessing."
44
+ "managers`` 模組中還提供了一個 :class:`~multiprocessing.managers.BaseManager` "
45
+ "子類別 :class:`SharedMemoryManager`。"
40
46
41
47
#: ../../library/multiprocessing.shared_memory.rst:26
42
48
msgid ""
@@ -52,6 +58,13 @@ msgid ""
52
58
"via disk or socket or other communications requiring the serialization/"
53
59
"deserialization and copying of data."
54
60
msgstr ""
61
+ "在此模組中,共享記憶體是指「System V 風格」的共享記憶體區塊(儘管不一定如此明"
62
+ "確實作),而不是指「分散式共享記憶體 (distributed shared memory)」。這種型別"
63
+ "的共享記憶體允許不同的行程潛在地讀取和寫入易失性記憶體 (volatile memory) 的公"
64
+ "開(或共享)區域。通常,行程只能存取自己的行程記憶體空間,但共享記憶體允許在"
65
+ "行程之間共享資料,從而避免了在包含該資料的行程之間發送訊息的需求。與透過硬碟"
66
+ "或 socket 或其他需要序列化/還原序列化 (serialization/deserialization) 和複製"
67
+ "資料的通訊方式以共享資料相比,直接透過記憶體共享資料可以提供顯著的性能優勢。"
55
68
56
69
#: ../../library/multiprocessing.shared_memory.rst:41
57
70
msgid ""
@@ -61,6 +74,9 @@ msgid ""
61
74
"different process can attach to that same shared memory block using that "
62
75
"same name."
63
76
msgstr ""
77
+ "建立新的共享記憶體區塊或附加到現有的共享記憶體區塊。每個共享記憶體區塊都被分"
78
+ "配了一個唯一的名稱。透過這種方式,一個行程可以建立具有特定名稱的共享記憶體區"
79
+ "塊,而不同的行程可以使用該相同名稱附加到同一共享記憶體區塊。"
64
80
65
81
#: ../../library/multiprocessing.shared_memory.rst:47
66
82
msgid ""
@@ -71,28 +87,40 @@ msgid ""
71
87
"block is no longer needed by any process, the :meth:`unlink()` method should "
72
88
"be called to ensure proper cleanup."
73
89
msgstr ""
90
+ "作為跨行程共享資料的資源,共享記憶體區塊的壽命可能比建立它們的原始行程還要"
91
+ "長。當一個行程不再需要存取但其他行程可能仍需要的共享記憶體區塊時,應該呼叫 :"
92
+ "meth:`close()` 方法。當任何行程不再需要共享記憶體區塊時,應呼叫 :meth:"
93
+ "`unlink()` 方法以確保正確清理。"
74
94
75
95
#: ../../library/multiprocessing.shared_memory.rst:54
76
96
msgid ""
77
97
"*name* is the unique name for the requested shared memory, specified as a "
78
98
"string. When creating a new shared memory block, if ``None`` (the default) "
79
99
"is supplied for the name, a novel name will be generated."
80
100
msgstr ""
101
+ "*name* 是所請求的共享記憶體的唯一名稱,指定為字串。建立新的共享記憶體區塊時,"
102
+ "如果名稱提供為 ``None``\\ (預設值),則會生成一個新的名稱。"
81
103
82
104
#: ../../library/multiprocessing.shared_memory.rst:58
83
105
msgid ""
84
106
"*create* controls whether a new shared memory block is created (``True``) or "
85
107
"an existing shared memory block is attached (``False``)."
86
108
msgstr ""
109
+ "*create* 控制是否建立新的共享記憶體區塊 (``True``) 或附加現有的共享記憶體區"
110
+ "塊 (``False``)。"
87
111
88
112
#: ../../library/multiprocessing.shared_memory.rst:61
113
+ #, fuzzy
89
114
msgid ""
90
115
"*size* specifies the requested number of bytes when creating a new shared "
91
116
"memory block. Because some platforms choose to allocate chunks of memory "
92
117
"based upon that platform's memory page size, the exact size of the shared "
93
118
"memory block may be larger or equal to the size requested. When attaching "
94
119
"to an existing shared memory block, the ``size`` parameter is ignored."
95
120
msgstr ""
121
+ "*size* 指定建立新共享記憶體區塊時請求的位元組數。由於某些平台選擇根據該平台的"
122
+ "記憶體頁大小來分配記憶體區塊,因此共享記憶體區塊的確切大小可能大於或等於請求"
123
+ "的大小。當附加到現有共享記憶體區塊時,``size`` 參數將被忽略。"
96
124
97
125
#: ../../library/multiprocessing.shared_memory.rst:69
98
126
msgid ""
@@ -101,8 +129,12 @@ msgid ""
101
129
"instance is no longer needed. Note that calling ``close()`` does not cause "
102
130
"the shared memory block itself to be destroyed."
103
131
msgstr ""
132
+ "關閉從此實例對共享記憶體的存取。為了確保正確清理資源,一旦不再需要實例,所有"
133
+ "實例都應該呼叫 ``close()``。請注意,呼叫 ``close()`` 不會使得共享記憶體區塊本"
134
+ "身被銷毀。"
104
135
105
136
#: ../../library/multiprocessing.shared_memory.rst:77
137
+ #, fuzzy
106
138
msgid ""
107
139
"Requests that the underlying shared memory block be destroyed. In order to "
108
140
"ensure proper cleanup of resources, ``unlink()`` should be called once (and "
@@ -114,39 +146,49 @@ msgid ""
114
146
"relinquishing its hold on a shared memory block may call ``unlink()`` and :"
115
147
"meth:`close()` in either order."
116
148
msgstr ""
149
+ "請求銷毀底層共享記憶體區塊。為了確保正確清理資源,應該在需要共享記憶體區塊的"
150
+ "所有行程中呼叫一次(且僅一次)\\ ``unlink()``。請求銷毀後,共享記憶體區塊可能"
151
+ "會也可能不會立即銷毀,並且此行為可能因平台而異。呼叫 ``unlink()`` 後嘗試存取"
152
+ "共享記憶體區塊內的資料可能會導致記憶體存取錯誤。注意:最後一個放棄對共享記憶"
153
+ "體區塊的持有的行程可以按任意順序呼叫 ``unlink()`` 和 :meth:`close()`。"
117
154
118
155
#: ../../library/multiprocessing.shared_memory.rst:90
119
156
msgid "A memoryview of contents of the shared memory block."
120
- msgstr ""
157
+ msgstr "共享記憶體區塊內容的記憶體視圖 (memoryview)。 "
121
158
122
159
#: ../../library/multiprocessing.shared_memory.rst:94
123
160
msgid "Read-only access to the unique name of the shared memory block."
124
- msgstr ""
161
+ msgstr "對共享記憶體區塊之唯一名稱的唯讀存取。 "
125
162
126
163
#: ../../library/multiprocessing.shared_memory.rst:98
127
164
msgid "Read-only access to size in bytes of the shared memory block."
128
- msgstr ""
165
+ msgstr "對共享記憶體區塊大小(以位元組為單位)的唯讀存取。 "
129
166
130
167
#: ../../library/multiprocessing.shared_memory.rst:101
131
168
msgid ""
132
169
"The following example demonstrates low-level use of :class:`SharedMemory` "
133
170
"instances::"
134
- msgstr ""
171
+ msgstr "以下範例示範了 :class:`SharedMemory` 實例的低階使用方式:: : "
135
172
136
173
#: ../../library/multiprocessing.shared_memory.rst:127
137
174
msgid ""
138
175
"The following example demonstrates a practical use of the :class:"
139
176
"`SharedMemory` class with `NumPy arrays <https://numpy.org/>`_, accessing "
140
177
"the same ``numpy.ndarray`` from two distinct Python shells:"
141
178
msgstr ""
179
+ "以下範例示範了 :class:`SharedMemory` 類別與 `NumPy 陣列 <https://numpy.org/"
180
+ ">`_ 的實際用法:從兩個不同的 Python shell 存取相同的 ``numpy.ndarray``:"
142
181
143
182
#: ../../library/multiprocessing.shared_memory.rst:181
144
183
msgid ""
145
184
"A subclass of :class:`~multiprocessing.managers.BaseManager` which can be "
146
185
"used for the management of shared memory blocks across processes."
147
186
msgstr ""
187
+ ":class:`~multiprocessing.managers.BaseManager` 的子類別,可用於跨行程管理共享"
188
+ "記憶體區塊。"
148
189
149
190
#: ../../library/multiprocessing.shared_memory.rst:184
191
+ #, fuzzy
150
192
msgid ""
151
193
"A call to :meth:`~multiprocessing.managers.BaseManager.start` on a :class:"
152
194
"`SharedMemoryManager` instance causes a new process to be started. This new "
@@ -159,13 +201,22 @@ msgid ""
159
201
"instances through a ``SharedMemoryManager``, we avoid the need to manually "
160
202
"track and trigger the freeing of shared memory resources."
161
203
msgstr ""
204
+ "在 :class:`SharedMemoryManager` 實例上呼叫:meth:`~multiprocessing.managers."
205
+ "BaseManager.start` 會導致啟動一個新行程。這個新行程的唯一目的是管理透過它建立"
206
+ "的所有共享記憶體區塊的生命週期。要觸發釋放該行程管理的所有共享記憶體區塊,請"
207
+ "在實例上呼叫:meth:`~multiprocessing.managers.BaseManager.shutdown()`。這會觸"
208
+ "發對該行程管理的所有 :class:`SharedMemory` 物件的 :meth:`SharedMemory."
209
+ "unlink()` 呼叫,然後停止行程本身。透過透過 ``SharedMemoryManager`` 建立 "
210
+ "``SharedMemory`` 實例,我們無需手動追蹤和觸發共享記憶體資源的釋放。"
162
211
163
212
#: ../../library/multiprocessing.shared_memory.rst:196
164
213
msgid ""
165
214
"This class provides methods for creating and returning :class:`SharedMemory` "
166
215
"instances and for creating a list-like object (:class:`ShareableList`) "
167
216
"backed by shared memory."
168
217
msgstr ""
218
+ "此類別提供了用於建立和回傳 :class:`SharedMemory` 實例以及建立由共享記憶體支援"
219
+ "的類列表物件 (:class:`ShareableList`) 的方法。"
169
220
170
221
#: ../../library/multiprocessing.shared_memory.rst:200
171
222
msgid ""
@@ -174,41 +225,56 @@ msgid ""
174
225
"may be used to connect to an existing ``SharedMemoryManager`` service from "
175
226
"other processes."
176
227
msgstr ""
228
+ "請參閱 :class:`multiprocessing.managers.BaseManager` 了解繼承的 *address* 和 "
229
+ "*authkey* 可選輸入引數的描述以及如何使用它們從其他行程連接到現有的 "
230
+ "``SharedMemoryManager`` 服務。"
177
231
178
232
#: ../../library/multiprocessing.shared_memory.rst:207
179
233
msgid ""
180
234
"Create and return a new :class:`SharedMemory` object with the specified "
181
235
"``size`` in bytes."
182
236
msgstr ""
237
+ "建立並回傳一個新的 :class:`SharedMemory` 物件,該物件具有指定的 ``size``\\ "
238
+ "(以位元組為單位)。"
183
239
184
240
#: ../../library/multiprocessing.shared_memory.rst:212
185
241
msgid ""
186
242
"Create and return a new :class:`ShareableList` object, initialized by the "
187
243
"values from the input ``sequence``."
188
244
msgstr ""
245
+ "建立並回傳一個新的 :class:`ShareableList` 物件,該物件由輸入 ``sequence`` 中"
246
+ "的值初始化。"
189
247
190
248
#: ../../library/multiprocessing.shared_memory.rst:216
191
249
msgid ""
192
250
"The following example demonstrates the basic mechanisms of a :class:"
193
251
"`SharedMemoryManager`:"
194
- msgstr ""
252
+ msgstr "以下範例示範了 :class:`SharedMemoryManager` 的基本作用機制: "
195
253
196
254
#: ../../library/multiprocessing.shared_memory.rst:234
255
+ #, fuzzy
197
256
msgid ""
198
257
"The following example depicts a potentially more convenient pattern for "
199
258
"using :class:`SharedMemoryManager` objects via the :keyword:`with` statement "
200
259
"to ensure that all shared memory blocks are released after they are no "
201
260
"longer needed:"
202
261
msgstr ""
262
+ "以下範例描述了一種可能更方便的模式,即透過 :keyword:`with` 陳述式使用 :class:"
263
+ "`SharedMemoryManager` 物件,以確保所有共享記憶體區塊在不再需要後都被釋放:"
203
264
204
265
#: ../../library/multiprocessing.shared_memory.rst:253
266
+ #, fuzzy
205
267
msgid ""
206
268
"When using a :class:`SharedMemoryManager` in a :keyword:`with` statement, "
207
269
"the shared memory blocks created using that manager are all released when "
208
270
"the :keyword:`with` statement's code block finishes execution."
209
271
msgstr ""
272
+ "在 :keyword:`with` 陳述式中使用 :class:`SharedMemoryManager` 時,當 :keyword:"
273
+ "`with` 陳述式的程式碼塊執行完畢時,使用該管理器建立的共享記憶體區塊都會被釋"
274
+ "放。"
210
275
211
276
#: ../../library/multiprocessing.shared_memory.rst:260
277
+ #, fuzzy
212
278
msgid ""
213
279
"Provides a mutable list-like object where all values stored within are "
214
280
"stored in a shared memory block. This constrains storable values to only "
@@ -219,13 +285,22 @@ msgid ""
219
285
"no append, insert, etc.) and do not support the dynamic creation of new :"
220
286
"class:`ShareableList` instances via slicing."
221
287
msgstr ""
288
+ "提供一個類似列表的可變物件,其中儲存的所有值都儲存在共享記憶體區塊中。這將可"
289
+ "存儲值限制為僅 ``int``(帶符號的 64 位)、``float``、``bool``、``str``(編碼"
290
+ "為 utf-8 時每個小於 10M 位元組), ``bytes`` (每個小於10M 位元組)和``None``"
291
+ "內建資料型別。它還與內建的 ``list`` 型別顯著不同,因為這些列表不能更改其總長"
292
+ "度(即不能追加、插入等),並且不支援動態建立新的 :class:`ShareableList` 透過"
293
+ "切片的實例。"
222
294
223
295
#: ../../library/multiprocessing.shared_memory.rst:270
296
+ #, fuzzy
224
297
msgid ""
225
298
"*sequence* is used in populating a new ``ShareableList`` full of values. Set "
226
299
"to ``None`` to instead attach to an already existing ``ShareableList`` by "
227
300
"its unique shared memory name."
228
301
msgstr ""
302
+ "*sequence* 用於填充一個充滿值的新 ``ShareableList``。設定為 ``None`` 以透過其"
303
+ "唯一的共享記憶體名稱附加到已經存在的 ``ShareableList``。"
229
304
230
305
#: ../../library/multiprocessing.shared_memory.rst:274
231
306
msgid ""
@@ -234,55 +309,71 @@ msgid ""
234
309
"``ShareableList``, specify its shared memory block's unique name while "
235
310
"leaving ``sequence`` set to ``None``."
236
311
msgstr ""
312
+ "如 :class:`SharedMemory` 的定義中所述,*name* 是被請求之共享記憶體的唯一名"
313
+ "稱。當附加到現有的 ``ShareableList`` 時,指定其共享記憶體區塊的唯一名稱,同時"
314
+ "將 ``sequence`` 設定為 ``None``。"
237
315
238
316
#: ../../library/multiprocessing.shared_memory.rst:281
317
+ #, fuzzy
239
318
msgid ""
240
319
"A known issue exists for :class:`bytes` and :class:`str` values. If they end "
241
320
"with ``\\ x00`` nul bytes or characters, those may be *silently stripped* "
242
321
"when fetching them by index from the :class:`ShareableList`. This ``."
243
322
"rstrip(b'\\ x00')`` behavior is considered a bug and may go away in the "
244
323
"future. See :gh:`106939`."
245
324
msgstr ""
325
+ ":class:`bytes` 和 :class:`str` 值存在一個已知問題。如果它們以 ``\\ x00`` nul "
326
+ "位元組或字元結尾,那麼當透過索引從 :class:`ShareableList` 中獲取它們時,這些"
327
+ "位元組或字元可能會被 *默默地剝離*。這種 ``.rstrip(b'\\ x00')`` 行為被認為是一"
328
+ "個錯誤,將來可能會消失。請參閱 :gh:`106939`。"
246
329
247
330
#: ../../library/multiprocessing.shared_memory.rst:287
331
+ #, fuzzy
248
332
msgid ""
249
333
"For applications where rstripping of trailing nulls is a problem, work "
250
334
"around it by always unconditionally appending an extra non-0 byte to the end "
251
335
"of such values when storing and unconditionally removing it when fetching:"
252
336
msgstr ""
337
+ "對於存在尾隨空值刪除問題的應用程序,可以透過在儲存時始終無條件地在此類值的末"
338
+ "尾附加一個額外的非 0 位元組並在獲取時無條件地刪除它來解決該問題:"
253
339
254
340
#: ../../library/multiprocessing.shared_memory.rst:310
255
341
msgid "Returns the number of occurrences of ``value``."
256
- msgstr ""
342
+ msgstr "回傳 ``value`` 出現的次數。 "
257
343
258
344
#: ../../library/multiprocessing.shared_memory.rst:314
259
345
msgid ""
260
346
"Returns first index position of ``value``. Raises :exc:`ValueError` if "
261
347
"``value`` is not present."
262
348
msgstr ""
349
+ "回傳 ``value`` 的第一個索引位置。如果 ``value`` 不存在,則引發 :exc:"
350
+ "`ValueError`。"
263
351
264
352
#: ../../library/multiprocessing.shared_memory.rst:319
265
353
msgid ""
266
354
"Read-only attribute containing the :mod:`struct` packing format used by all "
267
355
"currently stored values."
268
- msgstr ""
356
+ msgstr "唯讀屬性,包含所有目前有儲存的值所使用的 :mod:`struct` 打包格式。 "
269
357
270
358
#: ../../library/multiprocessing.shared_memory.rst:324
271
359
msgid "The :class:`SharedMemory` instance where the values are stored."
272
- msgstr ""
360
+ msgstr "儲存值的 :class:`SharedMemory` 實例。 "
273
361
274
362
#: ../../library/multiprocessing.shared_memory.rst:327
275
363
msgid ""
276
364
"The following example demonstrates basic use of a :class:`ShareableList` "
277
365
"instance:"
278
- msgstr ""
366
+ msgstr "以下範例示範了 :class:`ShareableList` 實例的基本用法: "
279
367
280
368
#: ../../library/multiprocessing.shared_memory.rst:360
369
+ #, fuzzy
281
370
msgid ""
282
371
"The following example depicts how one, two, or many processes may access the "
283
372
"same :class:`ShareableList` by supplying the name of the shared memory block "
284
373
"behind it:"
285
374
msgstr ""
375
+ "以下範例描述了一個、兩個或多個行程如何透過提供其後面的共享記憶體區塊的名稱來"
376
+ "存取同一個 :class:`ShareableList`:"
286
377
287
378
#: ../../library/multiprocessing.shared_memory.rst:375
288
379
msgid ""
@@ -292,6 +383,10 @@ msgid ""
292
383
"deserialized object has the same unique name and is just attached to an "
293
384
"existing object with the same name (if the object is still alive):"
294
385
msgstr ""
386
+ "以下範例示範了如果需要,可以對 ``ShareableList``\\ (和底層 "
387
+ "``SharedMemory``\\ )物件進行 pickle 和 unpickle。請注意,它仍然是相同的共享"
388
+ "物件。發生這種情況是因為反序列化的物件具有相同的唯一名稱,並且只是附加到具有"
389
+ "相同名稱的現有物件(如果該物件仍然存在):"
295
390
296
391
#: ../../library/multiprocessing.shared_memory.rst:11
297
392
msgid "Shared Memory"
0 commit comments