# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. # # Translators: # python-doc bot, 2025 # #, fuzzy msgid "" msgstr "" "Project-Id-Version: Python 3.9\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-01-03 16:35+0000\n" "PO-Revision-Date: 2025-09-22 17:54+0000\n" "Last-Translator: python-doc bot, 2025\n" "Language-Team: Chinese (China) (https://app.transifex.com/python-doc/teams/5390/zh_CN/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: zh_CN\n" "Plural-Forms: nplurals=1; plural=0;\n" #: ../../library/copyreg.rst:2 msgid ":mod:`copyreg` --- Register :mod:`pickle` support functions" msgstr ":mod:`copyreg` --- 注册配合 :mod:`pickle` 模块使用的函数" #: ../../library/copyreg.rst:7 msgid "**Source code:** :source:`Lib/copyreg.py`" msgstr "**源代码:** :source:`Lib/copyreg.py`" #: ../../library/copyreg.rst:15 msgid "" "The :mod:`copyreg` module offers a way to define functions used while " "pickling specific objects. The :mod:`pickle` and :mod:`copy` modules use " "those functions when pickling/copying those objects. The module provides " "configuration information about object constructors which are not classes. " "Such constructors may be factory functions or class instances." msgstr "" ":mod:`copyreg` 模块提供了可在封存特定对象时使用的一种定义函数方式。 :mod:`pickle` 和 :mod:`copy` " "模块会在封存/拷贝特定对象时使用这些函数。 此模块提供了非类对象构造器的相关配置信息。 这样的构造器可以是工厂函数或类实例。" #: ../../library/copyreg.rst:24 msgid "" "Declares *object* to be a valid constructor. If *object* is not callable " "(and hence not valid as a constructor), raises :exc:`TypeError`." msgstr "" "将 *object* 声明为一个有效的构造器。 如果 *object* 是不可调用的(因而不是一个有效的构造器)则会引发 " ":exc:`TypeError`。" #: ../../library/copyreg.rst:30 msgid "" "Declares that *function* should be used as a \"reduction\" function for " "objects of type *type*. *function* should return either a string or a tuple" " containing two or three elements." msgstr "" "声明该 *function* 应当被用作 *type* 类型对象的“归约函数”。 *function* 应当返回字符串或包含两到三个元素的元组。" #: ../../library/copyreg.rst:34 msgid "" "The optional *constructor* parameter, if provided, is a callable object " "which can be used to reconstruct the object when called with the tuple of " "arguments returned by *function* at pickling time. A :exc:`TypeError` is " "raised if the *constructor* is not callable." msgstr "" "如果提供了可选的 *constructor* 形参,它应当是一个可被用于重建相应对象的可调用对象,在调用该对象时要附带在执行封存操作时由 " "*function* 所返回的参数所组成的元组。 如果 *constructor* 不是可调用对象则将引发 :exc:`TypeError`。" #: ../../library/copyreg.rst:39 msgid "" "See the :mod:`pickle` module for more details on the interface expected of " "*function* and *constructor*. Note that the " ":attr:`~pickle.Pickler.dispatch_table` attribute of a pickler object or " "subclass of :class:`pickle.Pickler` can also be used for declaring reduction" " functions." msgstr "" "请查看 :mod:`pickle` 模块了解 *function* 和 *constructor* 所要求的接口的详情。 请注意一个 pickler " "对象或 :class:`pickle.Pickler` 的子类的 :attr:`~pickle.Pickler.dispatch_table` " "属性也可以被用来声明归约函数。" #: ../../library/copyreg.rst:46 msgid "Example" msgstr "示例" #: ../../library/copyreg.rst:48 msgid "" "The example below would like to show how to register a pickle function and " "how it will be used:" msgstr "以下示例将会显示如何注册一个封存函数,以及如何来使用它:"