Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 11f2d38

Browse files
[po] auto sync
1 parent 102870b commit 11f2d38

2 files changed

Lines changed: 15 additions & 15 deletions

File tree

.stat.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"translation": "94.99%", "updated_at": "2024-03-22T15:56:28Z"}
1+
{"translation": "94.99%", "updated_at": "2024-03-23T05:56:25Z"}

howto/annotations.po

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ msgid ""
1717
msgstr ""
1818
"Project-Id-Version: Python 3.12\n"
1919
"Report-Msgid-Bugs-To: \n"
20-
"POT-Creation-Date: 2024-03-15 14:13+0000\n"
20+
"POT-Creation-Date: 2024-03-22 14:14+0000\n"
2121
"PO-Revision-Date: 2021-06-28 00:52+0000\n"
2222
"Last-Translator: 乐成 王, 2024\n"
2323
"Language-Team: Chinese (China) (https://app.transifex.com/python-doc/teams/5390/zh_CN/)\n"
@@ -49,7 +49,7 @@ msgid ""
4949
" annotations dicts. If you write Python code that examines "
5050
"``__annotations__`` on Python objects, we encourage you to follow the "
5151
"guidelines described below."
52-
msgstr "本文档旨在概括与注解字典打交道的最佳实践。查看 Python 对象的 ``__annotations__`` 的代码应遵循下述准则。"
52+
msgstr "本文档旨在概括与注解字典打交道的最佳实践。查看 Python 对象的 ``__annotations__`` 的代码应遵循下面的准则。"
5353

5454
#: ../../howto/annotations.rst:16
5555
msgid ""
@@ -70,8 +70,7 @@ msgid ""
7070
"information on how to use \"type hints\" in your code, please see the "
7171
":mod:`typing` module."
7272
msgstr ""
73-
"本文是 ``__annotations__`` 的文档,不是介绍注解用法的文档。如果要查找关于如何使用“类型提示”的信息,请参阅 "
74-
":mod:`typing` 模块。"
73+
"本文是 ``__annotations__`` 的文档,不是注解的用法。如果在寻找如何使用“类型提示”,请参阅 :mod:`typing` 模块。"
7574

7675
#: ../../howto/annotations.rst:33
7776
msgid "Accessing The Annotations Dict Of An Object In Python 3.10 And Newer"
@@ -114,7 +113,7 @@ msgid ""
114113
msgstr ""
115114
"不过,其它类型的可调用对象可不一定定义了 ``__annotations__`` 属性,就比如说,:func:`functools.partial` "
116115
"创建的可调用对象。当访问某个未知对象的 ``__annotations__`` 时,3.10 及更高版本的 Python 中的最佳实践是用三个参数去调用"
117-
" :func:`getattr`,类似 ``getattr(o, '__annotations__', None)`` 这样。"
116+
" :func:`getattr`, ``getattr(o, '__annotations__', None)`` 这样。"
118117

119118
#: ../../howto/annotations.rst:60
120119
msgid ""
@@ -123,8 +122,8 @@ msgid ""
123122
"parent's ``__annotations__``. In Python 3.10 and newer, the child class's "
124123
"annotations will be an empty dict instead."
125124
msgstr ""
126-
"Python 3.10 之前,在一个没定义注解而父类定义了注解的类上访问 ``__annotations__`` 将返回父类的 "
127-
"``__annotations__``。在 3.10 及更高版本的 Python 中,这样的子类的标注是一个空字典。"
125+
"Python 3.10 之前,在一个没定义注解而其父类定义了注解的类上访问 ``__annotations__`` 将返回父类的 "
126+
"``__annotations__``。在 3.10 及更高版本的 Python 中,这样的子类的注解是个空字典。"
128127

129128
#: ../../howto/annotations.rst:68
130129
msgid "Accessing The Annotations Dict Of An Object In Python 3.9 And Older"
@@ -157,12 +156,13 @@ msgid ""
157156
"``__annotations__`` attribute of a class may inadvertently return the "
158157
"annotations dict of a *base class.* As an example::"
159158
msgstr ""
160-
"不幸的是,对于类而言,这并不是最佳做法。因为 ```__annotations__`` 是类的可选属性,并且类可以从基类继承属性,访问某个类的 "
161-
"``__annotations__`` 属性可能会无意间返回 *基类* 的注解数据。例如:"
159+
"不幸的是,对类而言,这并不是最佳实践。问题在于,由于 ``__annotations__`` "
160+
"在某个类上是可有可无的,而类又可以从基类继承属性,所以访问某个类的 ``__annotations__`` 属性可能会无意间返回 *基类* "
161+
"的注解字典。如:"
162162

163163
#: ../../howto/annotations.rst:98
164164
msgid "This will print the annotations dict from ``Base``, not ``Derived``."
165-
msgstr "如此会打印出 ``Base`` 的注解字典,而非 ``Derived`` 的。"
165+
msgstr "会打印出 ``Base`` 的注解字典,而非 ``Derived`` 的。"
166166

167167
#: ../../howto/annotations.rst:101
168168
msgid ""
@@ -173,9 +173,9 @@ msgid ""
173173
" Since the class may or may not have annotations defined, best practice is "
174174
"to call the ``get`` method on the class dict."
175175
msgstr ""
176-
"若要查看的对象是个类(``isinstance(o, type)``),代码不得不另辟蹊径。这时的最佳做法依赖于 Python 3.9 "
177-
"及之前版本的一处细节:若某个类定义了注解,则会存放于字典 ``__dict__`` 中。由于类不一定会定义注解,最好的做法是在类的 dict 上调用 "
178-
"``get`` 方法。"
176+
"若待检查的对象是类(即 ``isinstance(o, type)``),代码不得不另辟蹊径。这时的最佳实践依赖于 3.9 及更低版本的 Python "
177+
"中的一处实现细节:若类定义了注解,则注解会被放入类的 ``__dict__`` 字典。类不一定有注解,故最佳实践是在类的字典上调用 ``get`` "
178+
"方法。"
179179

180180
#: ../../howto/annotations.rst:109
181181
msgid ""
@@ -334,7 +334,7 @@ msgstr "应避免删除对象的 ``__annotations__`` 属性。"
334334

335335
#: ../../howto/annotations.rst:198
336336
msgid "``__annotations__`` Quirks"
337-
msgstr "``__annotations__`` 的坑"
337+
msgstr "``__annotations__`` 的一些“坑”"
338338

339339
#: ../../howto/annotations.rst:200
340340
msgid ""

0 commit comments

Comments
 (0)