1212# ppcfish <[email protected] >, 20191313# Meng Du <[email protected] >, 20201414# MuSheng Chen <[email protected] >, 202015- # Freesand Leo <[email protected] >, 20201615# Siyuan Xu <[email protected] >, 202016+ # Freesand Leo <[email protected] >, 20201717# jaystone776, 2020
1818#
1919#, fuzzy
@@ -143,21 +143,21 @@ msgstr "更确切地说,表达式 ``some_value is Derived(some_value)`` 在运
143143msgid ""
144144"This also means that it is not possible to create a subtype of ``Derived`` "
145145"since it is an identity function at runtime, not an actual type::"
146- msgstr "这也意味着无法创建 ``Derived`` 的子类型,因为它是运行时的标识函数,而不是实际的类型 ::"
146+ msgstr "并且也无法为 ``Derived`` 创建子类型,因为在运行时,它是标识函数,而不是真正的类型 ::"
147147
148148#: ../../library/typing.rst:123
149149msgid ""
150150"However, it is possible to create a :func:`NewType` based on a 'derived' "
151151"``NewType``::"
152- msgstr "但是,可以基于 'derived' ``NewType`` 创建 :func:`NewType` ::"
152+ msgstr "但是,可基于 'derived' ``NewType`` 创建 :func:`NewType` ::"
153153
154154#: ../../library/typing.rst:131
155155msgid "and typechecking for ``ProUserId`` will work as expected."
156- msgstr "并且 ``ProUserId`` 的类型检查将按预期工作 。"
156+ msgstr "并且 ``ProUserId`` 的类型检查也能正常运行 。"
157157
158158#: ../../library/typing.rst:133
159159msgid "See :pep:`484` for more details."
160- msgstr "有关更多详细信息,请参阅 :pep:`484`。"
160+ msgstr "详情请参阅 :pep:`484`。"
161161
162162#: ../../library/typing.rst:137
163163msgid ""
@@ -166,8 +166,8 @@ msgid ""
166166"treat ``Alias`` as being *exactly equivalent* to ``Original`` in all cases. "
167167"This is useful when you want to simplify complex type signatures."
168168msgstr ""
169- "回想一下,使用类型别名声明两种类型彼此 *等效* 。 ``Alias = Original`` 将使静态类型检查对待所有情况下 ``Alias`` "
170- "*完全等同于* ``Original``。当您想简化复杂类型签名时,这很有用 。"
169+ "回想一下,类型别名声明了两种彼此 *等效* 的类型。 ``Alias = Original`` 使得静态类型检查器在所有情况下把 ``Alias`` 与 "
170+ " ``Original`` 视为 *完全等效*。 简化复杂类型签名时,这种方式很有用 。"
171171
172172#: ../../library/typing.rst:142
173173msgid ""
@@ -178,9 +178,9 @@ msgid ""
178178"``Derived`` is expected. This is useful when you want to prevent logic "
179179"errors with minimal runtime cost."
180180msgstr ""
181- "相反 ,``NewType`` 声明一种类型是另一种类型的子类型 。``Derived = NewType('Derived', Original)`` "
182- "将使静态类型检查器将 ``Derived`` 当作 ``Original`` 的 *子类* ,这意味着 ``Original`` 类型的值不能用于 "
183- "``Derived`` 类型的值需要的地方。当您想以最小的运行时间成本防止逻辑错误时,这非常有用 。"
181+ "反之 ,``NewType`` 声明把一种类型当作另一种类型的*子类型* 。``Derived = NewType('Derived', "
182+ "Original)`` 让静态类型检查器把 ``Derived`` 当作 ``Original`` 的*子类* ,即, ``Original`` "
183+ "类型的值不能用于 ``Derived`` 类型的值需要的地方。以最小运行时成本防止逻辑错误时,这种方式非常有用 。"
184184
185185#: ../../library/typing.rst:152
186186msgid "Callable"
@@ -191,7 +191,7 @@ msgid ""
191191"Frameworks expecting callback functions of specific signatures might be type"
192192" hinted using ``Callable[[Arg1Type, Arg2Type], ReturnType]``."
193193msgstr ""
194- "期望特定签名的回调函数的框架可以将类型标注为 ``Callable[[Arg1Type, Arg2Type], ReturnType]``。"
194+ "预期特定签名回调函数的框架可以用 ``Callable[[Arg1Type, Arg2Type], ReturnType]`` 进行类型标注 。"
195195
196196#: ../../library/typing.rst:157
197197msgid "For example::"
@@ -203,24 +203,25 @@ msgid ""
203203"the call signature by substituting a literal ellipsis for the list of "
204204"arguments in the type hint: ``Callable[..., ReturnType]``."
205205msgstr ""
206- "通过用文字省略号替换类型提示中的参数列表: ``Callable[...,ReturnType]``,可以声明可调用的返回类型,而无需指定调用签名。"
206+ "无需指定调用签名,只需用字面省略号替换类型提示里的参数列表: ``Callable[..., "
207+ "ReturnType]``,就可以声明可调用对象的返回类型。"
207208
208209#: ../../library/typing.rst:175
209210msgid "Generics"
210- msgstr "泛型( Generic) "
211+ msgstr "泛型( Generic) "
211212
212213#: ../../library/typing.rst:177
213214msgid ""
214215"Since type information about objects kept in containers cannot be statically"
215216" inferred in a generic way, abstract base classes have been extended to "
216217"support subscription to denote expected types for container elements."
217- msgstr "由于无法以通用方式静态推断有关保存在容器中的对象的类型信息,因此抽象基类已扩展为支持订阅以表示容器元素的预期类型 。"
218+ msgstr "鉴于,容器中的对象类型信息不能以泛型方式进行静态推断,扩展的抽象基类支持订阅,用于表示容器元素的预期类型 。"
218219
219220#: ../../library/typing.rst:188
220221msgid ""
221222"Generics can be parameterized by using a new factory available in typing "
222223"called :class:`TypeVar`."
223- msgstr "泛型可以通过使用typing模块中名为 :class:`TypeVar` 的新工厂进行参数化 。"
224+ msgstr "泛型可以用 typing 模块的 :class:`TypeVar` 新工厂函数实现参数化 。"
224225
225226#: ../../library/typing.rst:203
226227msgid "User-defined generic types"
@@ -236,58 +237,58 @@ msgid ""
236237"single type parameter ``T`` . This also makes ``T`` valid as a type within "
237238"the class body."
238239msgstr ""
239- "``Generic[T]`` 作为基类定义了类 ``LoggedVar`` 采用单个类型参数 ``T``。这也使得 ``T`` "
240- "作为类体内的一个类型有效 。"
240+ "``Generic[T]`` 是定义 ``LoggedVar`` 类的基类,``LoggedVar`` 类采用单类型参数 "
241+ "``T``。因此,在该类体中,``T`` 是有效的类型 。"
241242
242243#: ../../library/typing.rst:235
243244msgid ""
244245"The :class:`Generic` base class defines :meth:`__class_getitem__` so that "
245246"``LoggedVar[t]`` is valid as a type::"
246247msgstr ""
247- ":class:`Generic` 基类定义了 :meth:`__class_getitem__` ,使得 ``LoggedVar[t]`` "
248- "作为类型有效 :"
248+ ":class:`Generic` 基类定义了 :meth:`__class_getitem__` ,因此, ``LoggedVar[t]`` "
249+ "也是有效类型 :"
249250
250251#: ../../library/typing.rst:244
251252msgid ""
252253"A generic type can have any number of type variables, and type variables may"
253254" be constrained::"
254- msgstr "泛型类型可以有任意数量的类型变量,并且类型变量可能会受到限制 ::"
255+ msgstr "泛型类型变量的数量不限,但类型变量可能会受限 ::"
255256
256257#: ../../library/typing.rst:256
257258msgid ""
258259"Each type variable argument to :class:`Generic` must be distinct. This is "
259260"thus invalid::"
260- msgstr ":class:`Generic` 每个参数的类型变量必须是不同的。这是无效的 ::"
261+ msgstr ":class:`Generic` 类型变量的每个参数绝不能相同。下列代码是无效的 ::"
261262
262263#: ../../library/typing.rst:267
263264msgid "You can use multiple inheritance with :class:`Generic`::"
264- msgstr "您可以对 :class:`Generic` 使用多重继承 ::"
265+ msgstr ":class:`Generic` 可使用多重继承 ::"
265266
266267#: ../../library/typing.rst:277
267268msgid ""
268269"When inheriting from generic classes, some type variables could be fixed::"
269- msgstr "从泛型类继承时,某些类型变量可能是固定的 ::"
270+ msgstr "从泛型类继承时,有些类型变量可能是固定的 ::"
270271
271272#: ../../library/typing.rst:287
272273msgid "In this case ``MyDict`` has a single parameter, ``T``."
273- msgstr "在这种情况下 ,``MyDict`` 只有一个参数 ,``T``。"
274+ msgstr "本例中 ,``MyDict`` 调用了单参数 ,``T``。"
274275
275276#: ../../library/typing.rst:289
276277msgid ""
277278"Using a generic class without specifying type parameters assumes :data:`Any`"
278279" for each position. In the following example, ``MyIterable`` is not generic "
279280"but implicitly inherits from ``Iterable[Any]``::"
280281msgstr ""
281- "在不指定类型参数的情况下使用泛型类别会为每个位置假设 :data:`Any`。在下面的例子中 ,``MyIterable`` 不是泛型,但是隐式继承自 "
282- "``Iterable[Any]``:: "
282+ "应用泛型类,但未指定类型参数时,每个位置的类型都会被预设为 :data:`Any`。下例中 ,``MyIterable`` 虽然不是泛型,但却隐式地继承了 "
283+ " ``Iterable[Any]``: "
283284
284285#: ../../library/typing.rst:297
285286msgid "User defined generic type aliases are also supported. Examples::"
286- msgstr "用户定义的通用类型别名也受支持。例子:: "
287+ msgstr "用户定义的泛型类型别名也受支持。如: "
287288
288289#: ../../library/typing.rst:314
289290msgid ":class:`Generic` no longer has a custom metaclass."
290- msgstr ":class:`Generic` 不再拥有一个自定义的元类 。"
291+ msgstr ":class:`Generic` 不再支持自定义元类 。"
291292
292293#: ../../library/typing.rst:317
293294msgid ""
@@ -296,8 +297,8 @@ msgid ""
296297"parameterizing generics is cached, and most types in the typing module are "
297298"hashable and comparable for equality."
298299msgstr ""
299- "一个用户定义的泛型类能够使用抽象基本类作为基类,而不会发生元类冲突。泛型元类不再被支持 。参数化泛型的结果会被缓存,并且在 typing "
300- "模块中的大部分类型是可哈希且可比较相等性的 。"
300+ "抽象基类可以作为用户定义泛型类的基类,且不会产生元类冲突。泛型的元类已被废弃 。参数化泛型的结果会被缓存,typing "
301+ "模块里,大多数类型都可哈希、可实现等效对比 。"
301302
302303#: ../../library/typing.rst:324
303304msgid "The :data:`Any` type"
@@ -309,8 +310,7 @@ msgid ""
309310"every type as being compatible with :data:`Any` and :data:`Any` as being "
310311"compatible with every type."
311312msgstr ""
312- ":data:`Any` 是一种特殊的类型。静态类型检查器将所有类型视为与 :data:`Any` 兼容,反之亦然, :data:`Any` "
313- "也与所有类型相兼容。"
313+ ":data:`Any` 是一种特殊类型。静态类型检查器认为所有类型均与 :data:`Any` 兼容,同样, :data:`Any` 也与所有类型兼容。"
314314
315315#: ../../library/typing.rst:330
316316msgid ""
@@ -517,6 +517,8 @@ msgid ""
517517":class:`builtins.tuple <tuple>` now supports ``[]``. See :pep:`585` and :ref"
518518":`types-genericalias`."
519519msgstr ""
520+ ":class:`builtins.tuple <tuple>` 现已支持 ``[]``。 请参阅 :pep:`585` and :ref:`types-"
521+ "genericalias`。"
520522
521523#: ../../library/typing.rst:517
522524msgid "Union type; ``Union[X, Y]`` means either X or Y."
@@ -615,6 +617,8 @@ msgid ""
615617":class:`collections.abc.Callable` now supports ``[]``. See :pep:`585` and "
616618":ref:`types-genericalias`."
617619msgstr ""
620+ ":class:`collections.abc.Callable` 现已支持 ``[]``。 请参阅 :pep:`585` 与 :ref:`types-"
621+ "genericalias`."
618622
619623#: ../../library/typing.rst:592
620624msgid ""
@@ -623,8 +627,8 @@ msgid ""
623627"classes themselves -- specifically, it will accept the *class object* of "
624628"``C``. For example::"
625629msgstr ""
626- "一个注解为 ``C`` 的变量可以接受一个类型为 ``C`` 的值。相对地,一个注解为 ``Type[C]`` 的变量可以接受本身为类的值 —— "
627- "更精确地说它接受 ``C`` 的 *类对象* ,例如:"
630+ "用 ``C`` 标注的变量可以接受类型为 ``C`` 的值。反之,用 ``Type[C]`` 标注的变量可以接受类本身的值 — 准确地说,是接受 "
631+ "``C`` 的 *类对象*,例如:"
628632
629633#: ../../library/typing.rst:601
630634msgid "Note that ``Type[C]`` is covariant::"
@@ -662,6 +666,8 @@ msgid ""
662666":class:`builtins.type <type>` now supports ``[]``. See :pep:`585` and :ref"
663667":`types-genericalias`."
664668msgstr ""
669+ ":class:`builtins.type <type>` 现已支持 ``[]``。 请参阅 :pep:`585` and :ref:`types-"
670+ "genericalias`。"
665671
666672#: ../../library/typing.rst:638
667673msgid ""
@@ -723,7 +729,7 @@ msgstr "一个特殊的类型构造来指示类型检查器该名称不能被再
723729msgid ""
724730"There is no runtime checking of these properties. See :pep:`591` for more "
725731"details."
726- msgstr ""
732+ msgstr "这些属性没有运行时检查。详情请参阅 :pep:`591`。 "
727733
728734#: ../../library/typing.rst:711
729735msgid ""
@@ -781,17 +787,17 @@ msgstr ""
781787
782788#: ../../library/typing.rst:751
783789msgid "The details of the syntax:"
784- msgstr ""
790+ msgstr "语义详情: "
785791
786792#: ../../library/typing.rst:753
787793msgid "The first argument to ``Annotated`` must be a valid type"
788- msgstr ""
794+ msgstr "``Annotated`` 的第一个参数必须是有效类型。 "
789795
790796#: ../../library/typing.rst:755
791797msgid ""
792798"Multiple type annotations are supported (``Annotated`` supports variadic "
793799"arguments)::"
794- msgstr ""
800+ msgstr "支持多个类型标注 (``Annotated`` 支持可变参数):: "
795801
796802#: ../../library/typing.rst:760
797803msgid ""
0 commit comments