@@ -41,7 +41,7 @@ msgid ""
4141" and objects containing lots of shared sub-objects. The keys are ordinary "
4242"strings."
4343msgstr ""
44- "\" shelf \" 是一种持久化的类似字典的对象。 与 \" dbm\" 数据库的区别在于 shelf 中的值(不是键!)实际上可以为任意 Python "
44+ "\" Shelf \" 是一种持久化的类似字典的对象。 与 \" dbm\" 数据库的区别在于 Shelf 中的值(不是键!)实际上可以为任意 Python "
4545"对象 --- 即 :mod:`pickle` 模块能够处理的任何东西。 这包括大部分类实例、递归数据类型,以及包含大量共享子对象的对象。 "
4646"键则为普通的字符串。"
4747
@@ -77,7 +77,7 @@ msgid ""
7777"determine which accessed entries are mutable, nor which ones were actually "
7878"mutated)."
7979msgstr ""
80- "由于 Python 语义的限制,shelf 无法确定一个可变的持久化字典条目在何时被修改 。 默认情况下 *只有* 在被修改对象再赋值给 shelf "
80+ "由于 Python 语义的限制,Shelf 对象无法确定一个可变的持久化字典条目在何时被修改 。 默认情况下 *只有* 在被修改对象再赋值给 shelf "
8181"时才会写入该对象 (参见 :ref:`shelve-example`)。 如果可选的 *writeback* 形参设为 "
8282"``True``,则所有被访问的条目都将在内存中被缓存,并会在 :meth:`~Shelf.sync` 和 :meth:`~Shelf.close` "
8383"时被写入;这可以使得对持久化字典中可变条目的修改更方便,但是如果访问的条目很多,这会消耗大量内存作为缓存,并会使得关闭操作变得非常缓慢,因为所有被访问的条目都需要写回到字典(无法确定被访问的条目中哪个是可变的,也无法确定哪个被实际修改了)。"
@@ -88,7 +88,7 @@ msgid ""
8888":meth:`~Shelf.close` explicitly when you don't need it any more, or use "
8989":func:`shelve.open` as a context manager::"
9090msgstr ""
91- "请不要依赖于 shelf 的自动关闭功能;当你不再需要时应当总是显式地调用 :meth:`~Shelf.close`,或者使用 "
91+ "请不要依赖于 Shelf 的自动关闭功能;当你不再需要时应当总是显式地调用 :meth:`~Shelf.close`,或者使用 "
9292":func:`shelve.open` 作为上下文管理器::"
9393
9494#: /home/travis/build/python/cpython-doc-catalog/Doc/library/shelve.rst:54
@@ -98,14 +98,14 @@ msgid ""
9898" can execute arbitrary code."
9999msgstr ""
100100"由于 :mod:`shelve` 模块需要 :mod:`pickle` 的支持,因此从不可靠的来源载入 shelf 是不安全的。 与 pickle "
101- "一样,载入 shelf 时可以执行任意代码。"
101+ "一样,载入 Shelf 时可以执行任意代码。"
102102
103103#: /home/travis/build/python/cpython-doc-catalog/Doc/library/shelve.rst:58
104104msgid ""
105105"Shelf objects support all methods supported by dictionaries. This eases the"
106106" transition from dictionary based scripts to those requiring persistent "
107107"storage."
108- msgstr "字典所支持的所有方法都被 shelf 对象所支持。 因此很容易将基于字典的代码转换为需要持久化存储的代码。"
108+ msgstr "字典所支持的所有方法都被 Shelf 对象所支持。 因此很容易将基于字典的代码转换为需要持久化存储的代码。"
109109
110110#: /home/travis/build/python/cpython-doc-catalog/Doc/library/shelve.rst:61
111111msgid "Two additional methods are supported:"
@@ -118,14 +118,14 @@ msgid ""
118118"dictionary on disk, if feasible. This is called automatically when the "
119119"shelf is closed with :meth:`close`."
120120msgstr ""
121- "如果 shelf 打开时将 *writeback* 设为 :const:`True` 则写回缓存中的所有条目。 "
122- "如果可行还会清空缓存并将持久化字典同步到磁盘。 此方法会在使用 :meth:`close` 关闭 shelf 时自动被调用。"
121+ "如果 Shelf 打开时将 *writeback* 设为 :const:`True` 则写回缓存中的所有条目。 "
122+ "如果可行还会清空缓存并将持久化字典同步到磁盘。 此方法会在使用 :meth:`close` 关闭 Shelf 时自动被调用。"
123123
124124#: /home/travis/build/python/cpython-doc-catalog/Doc/library/shelve.rst:72
125125msgid ""
126126"Synchronize and close the persistent *dict* object. Operations on a closed "
127127"shelf will fail with a :exc:`ValueError`."
128- msgstr "同步并关闭持久化 *dict* 对象。 对已关闭 shelf 的操作将失败并引发 :exc:`ValueError`。"
128+ msgstr "同步并关闭持久化 *dict* 对象。 对已关闭 Shelf 的操作将失败并引发 :exc:`ValueError`。"
129129
130130#: /home/travis/build/python/cpython-doc-catalog/Doc/library/shelve.rst:78
131131msgid ""
@@ -163,8 +163,8 @@ msgid ""
163163"this differs across Unix versions and requires knowledge about the database "
164164"implementation used."
165165msgstr ""
166- ":mod:`shelve` 模块不支持对 shelve 对象的 *并发* 读/写访问。 (多个同时读取访问则是安全的。) 当一个程序打开一个 "
167- "shelve 对象来写入时,不应再有其他程序同时打开它来读取或写入。 Unix 文件锁定可被用来解决此问题,但这在不同 Unix "
166+ ":mod:`shelve` 模块不支持对 Shelf 对象的 *并发* 读/写访问。 (多个同时读取访问则是安全的。) 当一个程序打开一个 shelve "
167+ " 对象来写入时,不应再有其他程序同时打开它来读取或写入。 Unix 文件锁定可被用来解决此问题,但这在不同 Unix "
168168"版本上会存在差异,并且需要有关所用数据库实现的细节知识。"
169169
170170#: /home/travis/build/python/cpython-doc-catalog/Doc/library/shelve.rst:108
@@ -189,24 +189,26 @@ msgid ""
189189"times. This allows natural operations on mutable entries, but can consume "
190190"much more memory and make sync and close take a long time."
191191msgstr ""
192+ "如果 *writeback* 形参为 ``True``,对象将为所有访问过的条目保留缓存并在同步和关闭时将它们写回到 *dict*。 "
193+ "这允许对可变的条目执行自然操作,但是会消耗更多内存并让同步和关闭花费更长时间。"
192194
193195#: /home/travis/build/python/cpython-doc-catalog/Doc/library/shelve.rst:120
194196msgid ""
195197"The *keyencoding* parameter is the encoding used to encode keys before they "
196198"are used with the underlying dict."
197- msgstr ""
199+ msgstr "*keyencoding* 形参是在下层字典被使用之前用于编码键的编码格式。 "
198200
199201#: /home/travis/build/python/cpython-doc-catalog/Doc/library/shelve.rst:123
200202msgid ""
201203"A :class:`Shelf` object can also be used as a context manager, in which case"
202204" it will be automatically closed when the :keyword:`with` block ends."
203- msgstr ""
205+ msgstr ":class:`Shelf` 对象还可以被用作上下文管理器,在这种情况下它将在 :keyword:`with` 语句块结束时自动被关闭。 "
204206
205207#: /home/travis/build/python/cpython-doc-catalog/Doc/library/shelve.rst:126
206208msgid ""
207209"Added the *keyencoding* parameter; previously, keys were always encoded in "
208210"UTF-8."
209- msgstr ""
211+ msgstr "添加了 *keyencoding* 形参;之前,键总是使用 UTF-8 编码。 "
210212
211213#: /home/travis/build/python/cpython-doc-catalog/Doc/library/shelve.rst:130
212214msgid "Added context manager support."
0 commit comments