Skip to content

Commit 6845d4a

Browse files
pydoc-zh-tw[bot]github-actions[bot]mattwang44
authored
Sync with CPython 3.11 (python#367)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Matt.Wang <mattwang44@gmail.com>
1 parent 30fecef commit 6845d4a

14 files changed

+723
-691
lines changed

c-api/arg.po

+231-211
Large diffs are not rendered by default.

howto/annotations.po

+42-34
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ msgid ""
77
msgstr ""
88
"Project-Id-Version: Python 3.11\n"
99
"Report-Msgid-Bugs-To: \n"
10-
"POT-Creation-Date: 2022-06-03 00:13+0000\n"
10+
"POT-Creation-Date: 2022-12-25 00:16+0000\n"
1111
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1212
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1313
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
@@ -91,18 +91,26 @@ msgid ""
9191
"three arguments, for example ``getattr(o, '__annotations__', None)``."
9292
msgstr ""
9393

94-
#: ../../howto/annotations.rst:62
94+
#: ../../howto/annotations.rst:60
95+
msgid ""
96+
"Before Python 3.10, accessing ``__annotations__`` on a class that defines no "
97+
"annotations but that has a parent class with annotations would return the "
98+
"parent's ``__annotations__``. In Python 3.10 and newer, the child class's "
99+
"annotations will be an empty dict instead."
100+
msgstr ""
101+
102+
#: ../../howto/annotations.rst:68
95103
msgid "Accessing The Annotations Dict Of An Object In Python 3.9 And Older"
96104
msgstr ""
97105

98-
#: ../../howto/annotations.rst:64
106+
#: ../../howto/annotations.rst:70
99107
msgid ""
100108
"In Python 3.9 and older, accessing the annotations dict of an object is much "
101109
"more complicated than in newer versions. The problem is a design flaw in "
102110
"these older versions of Python, specifically to do with class annotations."
103111
msgstr ""
104112

105-
#: ../../howto/annotations.rst:69
113+
#: ../../howto/annotations.rst:75
106114
msgid ""
107115
"Best practice for accessing the annotations dict of other objects--"
108116
"functions, other callables, and modules--is the same as best practice for "
@@ -111,7 +119,7 @@ msgid ""
111119
"``__annotations__`` attribute."
112120
msgstr ""
113121

114-
#: ../../howto/annotations.rst:76
122+
#: ../../howto/annotations.rst:82
115123
msgid ""
116124
"Unfortunately, this isn't best practice for classes. The problem is that, "
117125
"since ``__annotations__`` is optional on classes, and because classes can "
@@ -120,11 +128,11 @@ msgid ""
120128
"annotations dict of a *base class.* As an example::"
121129
msgstr ""
122130

123-
#: ../../howto/annotations.rst:92
131+
#: ../../howto/annotations.rst:98
124132
msgid "This will print the annotations dict from ``Base``, not ``Derived``."
125133
msgstr ""
126134

127-
#: ../../howto/annotations.rst:95
135+
#: ../../howto/annotations.rst:101
128136
msgid ""
129137
"Your code will have to have a separate code path if the object you're "
130138
"examining is a class (``isinstance(o, type)``). In that case, best practice "
@@ -134,81 +142,81 @@ msgid ""
134142
"practice is to call the ``get`` method on the class dict."
135143
msgstr ""
136144

137-
#: ../../howto/annotations.rst:103
145+
#: ../../howto/annotations.rst:109
138146
msgid ""
139147
"To put it all together, here is some sample code that safely accesses the "
140148
"``__annotations__`` attribute on an arbitrary object in Python 3.9 and "
141149
"before::"
142150
msgstr ""
143151

144-
#: ../../howto/annotations.rst:112
152+
#: ../../howto/annotations.rst:118
145153
msgid ""
146154
"After running this code, ``ann`` should be either a dictionary or ``None``. "
147155
"You're encouraged to double-check the type of ``ann`` using :func:"
148156
"`isinstance` before further examination."
149157
msgstr ""
150158

151-
#: ../../howto/annotations.rst:117
159+
#: ../../howto/annotations.rst:123
152160
msgid ""
153161
"Note that some exotic or malformed type objects may not have a ``__dict__`` "
154162
"attribute, so for extra safety you may also wish to use :func:`getattr` to "
155163
"access ``__dict__``."
156164
msgstr ""
157165

158-
#: ../../howto/annotations.rst:123
166+
#: ../../howto/annotations.rst:129
159167
msgid "Manually Un-Stringizing Stringized Annotations"
160168
msgstr ""
161169

162-
#: ../../howto/annotations.rst:125
170+
#: ../../howto/annotations.rst:131
163171
msgid ""
164172
"In situations where some annotations may be \"stringized\", and you wish to "
165173
"evaluate those strings to produce the Python values they represent, it "
166174
"really is best to call :func:`inspect.get_annotations` to do this work for "
167175
"you."
168176
msgstr ""
169177

170-
#: ../../howto/annotations.rst:131
178+
#: ../../howto/annotations.rst:137
171179
msgid ""
172180
"If you're using Python 3.9 or older, or if for some reason you can't use :"
173181
"func:`inspect.get_annotations`, you'll need to duplicate its logic. You're "
174182
"encouraged to examine the implementation of :func:`inspect.get_annotations` "
175183
"in the current Python version and follow a similar approach."
176184
msgstr ""
177185

178-
#: ../../howto/annotations.rst:137
186+
#: ../../howto/annotations.rst:143
179187
msgid ""
180188
"In a nutshell, if you wish to evaluate a stringized annotation on an "
181189
"arbitrary object ``o``:"
182190
msgstr ""
183191

184-
#: ../../howto/annotations.rst:140
192+
#: ../../howto/annotations.rst:146
185193
msgid ""
186194
"If ``o`` is a module, use ``o.__dict__`` as the ``globals`` when calling :"
187195
"func:`eval`."
188196
msgstr ""
189197

190-
#: ../../howto/annotations.rst:142
198+
#: ../../howto/annotations.rst:148
191199
msgid ""
192200
"If ``o`` is a class, use ``sys.modules[o.__module__].__dict__`` as the "
193201
"``globals``, and ``dict(vars(o))`` as the ``locals``, when calling :func:"
194202
"`eval`."
195203
msgstr ""
196204

197-
#: ../../howto/annotations.rst:145
205+
#: ../../howto/annotations.rst:151
198206
msgid ""
199207
"If ``o`` is a wrapped callable using :func:`functools.update_wrapper`, :func:"
200208
"`functools.wraps`, or :func:`functools.partial`, iteratively unwrap it by "
201209
"accessing either ``o.__wrapped__`` or ``o.func`` as appropriate, until you "
202210
"have found the root unwrapped function."
203211
msgstr ""
204212

205-
#: ../../howto/annotations.rst:149
213+
#: ../../howto/annotations.rst:155
206214
msgid ""
207215
"If ``o`` is a callable (but not a class), use ``o.__globals__`` as the "
208216
"globals when calling :func:`eval`."
209217
msgstr ""
210218

211-
#: ../../howto/annotations.rst:152
219+
#: ../../howto/annotations.rst:158
212220
msgid ""
213221
"However, not all string values used as annotations can be successfully "
214222
"turned into Python values by :func:`eval`. String values could theoretically "
@@ -217,63 +225,63 @@ msgid ""
217225
"be evaluated. For example:"
218226
msgstr ""
219227

220-
#: ../../howto/annotations.rst:159
228+
#: ../../howto/annotations.rst:165
221229
msgid ""
222230
":pep:`604` union types using ``|``, before support for this was added to "
223231
"Python 3.10."
224232
msgstr ""
225233

226-
#: ../../howto/annotations.rst:161
234+
#: ../../howto/annotations.rst:167
227235
msgid ""
228236
"Definitions that aren't needed at runtime, only imported when :const:`typing."
229237
"TYPE_CHECKING` is true."
230238
msgstr ""
231239

232-
#: ../../howto/annotations.rst:164
240+
#: ../../howto/annotations.rst:170
233241
msgid ""
234242
"If :func:`eval` attempts to evaluate such values, it will fail and raise an "
235243
"exception. So, when designing a library API that works with annotations, "
236244
"it's recommended to only attempt to evaluate string values when explicitly "
237245
"requested to by the caller."
238246
msgstr ""
239247

240-
#: ../../howto/annotations.rst:172
248+
#: ../../howto/annotations.rst:178
241249
msgid "Best Practices For ``__annotations__`` In Any Python Version"
242250
msgstr ""
243251

244-
#: ../../howto/annotations.rst:174
252+
#: ../../howto/annotations.rst:180
245253
msgid ""
246254
"You should avoid assigning to the ``__annotations__`` member of objects "
247255
"directly. Let Python manage setting ``__annotations__``."
248256
msgstr ""
249257

250-
#: ../../howto/annotations.rst:177
258+
#: ../../howto/annotations.rst:183
251259
msgid ""
252260
"If you do assign directly to the ``__annotations__`` member of an object, "
253261
"you should always set it to a ``dict`` object."
254262
msgstr ""
255263

256-
#: ../../howto/annotations.rst:180
264+
#: ../../howto/annotations.rst:186
257265
msgid ""
258266
"If you directly access the ``__annotations__`` member of an object, you "
259267
"should ensure that it's a dictionary before attempting to examine its "
260268
"contents."
261269
msgstr ""
262270

263-
#: ../../howto/annotations.rst:184
271+
#: ../../howto/annotations.rst:190
264272
msgid "You should avoid modifying ``__annotations__`` dicts."
265273
msgstr ""
266274

267-
#: ../../howto/annotations.rst:186
275+
#: ../../howto/annotations.rst:192
268276
msgid ""
269277
"You should avoid deleting the ``__annotations__`` attribute of an object."
270278
msgstr ""
271279

272-
#: ../../howto/annotations.rst:191
280+
#: ../../howto/annotations.rst:197
273281
msgid "``__annotations__`` Quirks"
274282
msgstr ""
275283

276-
#: ../../howto/annotations.rst:193
284+
#: ../../howto/annotations.rst:199
277285
msgid ""
278286
"In all versions of Python 3, function objects lazy-create an annotations "
279287
"dict if no annotations are defined on that object. You can delete the "
@@ -285,13 +293,13 @@ msgid ""
285293
"guaranteed to always throw an ``AttributeError``."
286294
msgstr ""
287295

288-
#: ../../howto/annotations.rst:203
296+
#: ../../howto/annotations.rst:209
289297
msgid ""
290298
"Everything in the above paragraph also applies to class and module objects "
291299
"in Python 3.10 and newer."
292300
msgstr ""
293301

294-
#: ../../howto/annotations.rst:206
302+
#: ../../howto/annotations.rst:212
295303
msgid ""
296304
"In all versions of Python 3, you can set ``__annotations__`` on a function "
297305
"object to ``None``. However, subsequently accessing the annotations on that "
@@ -302,15 +310,15 @@ msgid ""
302310
"set."
303311
msgstr ""
304312

305-
#: ../../howto/annotations.rst:214
313+
#: ../../howto/annotations.rst:220
306314
msgid ""
307315
"If Python stringizes your annotations for you (using ``from __future__ "
308316
"import annotations``), and you specify a string as an annotation, the string "
309317
"will itself be quoted. In effect the annotation is quoted *twice.* For "
310318
"example::"
311319
msgstr ""
312320

313-
#: ../../howto/annotations.rst:225
321+
#: ../../howto/annotations.rst:231
314322
msgid ""
315323
"This prints ``{'a': \"'str'\"}``. This shouldn't really be considered a "
316324
"\"quirk\"; it's mentioned here simply because it might be surprising."

library/argparse.po

+9-9
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ msgid ""
77
msgstr ""
88
"Project-Id-Version: Python 3.11\n"
99
"Report-Msgid-Bugs-To: \n"
10-
"POT-Creation-Date: 2022-11-23 00:17+0000\n"
10+
"POT-Creation-Date: 2022-12-26 13:06+0000\n"
1111
"PO-Revision-Date: 2018-05-23 14:38+0000\n"
1212
"Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n"
1313
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
@@ -756,7 +756,7 @@ msgid ""
756756
msgstr ""
757757

758758
#: ../../library/argparse.rst:758
759-
msgid "choices_ - A container of the allowable values for the argument."
759+
msgid "choices_ - A sequence of the allowable values for the argument."
760760
msgstr ""
761761

762762
#: ../../library/argparse.rst:760
@@ -1136,23 +1136,23 @@ msgstr ""
11361136
#: ../../library/argparse.rst:1201
11371137
msgid ""
11381138
"Some command-line arguments should be selected from a restricted set of "
1139-
"values. These can be handled by passing a container object as the *choices* "
1139+
"values. These can be handled by passing a sequence object as the *choices* "
11401140
"keyword argument to :meth:`~ArgumentParser.add_argument`. When the command "
11411141
"line is parsed, argument values will be checked, and an error message will "
11421142
"be displayed if the argument was not one of the acceptable values::"
11431143
msgstr ""
11441144

11451145
#: ../../library/argparse.rst:1216
11461146
msgid ""
1147-
"Note that inclusion in the *choices* container is checked after any type_ "
1147+
"Note that inclusion in the *choices* sequence is checked after any type_ "
11481148
"conversions have been performed, so the type of the objects in the *choices* "
1149-
"container should match the type_ specified::"
1149+
"sequence should match the type_ specified::"
11501150
msgstr ""
11511151

11521152
#: ../../library/argparse.rst:1228
11531153
msgid ""
1154-
"Any container can be passed as the *choices* value, so :class:`list` "
1155-
"objects, :class:`set` objects, and custom containers are all supported."
1154+
"Any sequence can be passed as the *choices* value, so :class:`list` "
1155+
"objects, :class:`tuple` objects, and custom sequences are all supported."
11561156
msgstr ""
11571157

11581158
#: ../../library/argparse.rst:1231
@@ -1211,8 +1211,8 @@ msgid ""
12111211
"The ``help`` strings can include various format specifiers to avoid "
12121212
"repetition of things like the program name or the argument default_. The "
12131213
"available specifiers include the program name, ``%(prog)s`` and most keyword "
1214-
"arguments to :meth:`~ArgumentParser.add_argument`, e.g. ``%(default)s``, ``"
1215-
"%(type)s``, etc.::"
1214+
"arguments to :meth:`~ArgumentParser.add_argument`, e.g. ``%(default)s``, "
1215+
"``%(type)s``, etc.::"
12161216
msgstr ""
12171217

12181218
#: ../../library/argparse.rst:1310

library/array.po

+2-2
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ msgid ""
215215
"``Py_UNICODE``. This change doesn't affect its behavior because "
216216
"``Py_UNICODE`` is alias of ``wchar_t`` since Python 3.3."
217217
msgstr ""
218-
"目前 ``array(‘u’)`` 使用 ``wchar_t`` 取代已棄用的 ``Py_UNICODE`` 作為 C "
218+
"目前 ``array('u')`` 使用 ``wchar_t`` 取代已棄用的 ``Py_UNICODE`` 作為 C "
219219
"type。這個異動並沒有影響到它的作用,因爲自從 Python 3.3 開始 ``Py_UNICODE`` "
220220
"即為 ``wchar_t`` 的別名。"
221221

@@ -476,7 +476,7 @@ msgid ""
476476
msgstr ""
477477
"當一個陣列物件被列印或轉換成字串時,它會被表示為 ``array(typecode, "
478478
"initializer)``\\ 。若為空陣列則參數 *initializer* 被省略,若 *typecode* 是 "
479-
"``’u’`` 將被表示為字串,其他情況則被表示為由數字組成的 list。只要 :class:"
479+
"``'u'`` 將被表示為字串,其他情況則被表示為由數字組成的 list。只要 :class:"
480480
"`~array.array` class(類別)透過 ``from array import array`` 的方式引入,便能"
481481
"確保該字串能透過 :func:`eval` 轉換回一個擁有相同型別及數值的陣列。範例:\n"
482482
"\n"

library/compileall.po

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ msgid ""
77
msgstr ""
88
"Project-Id-Version: Python 3.11\n"
99
"Report-Msgid-Bugs-To: \n"
10-
"POT-Creation-Date: 2022-10-15 20:43+0000\n"
10+
"POT-Creation-Date: 2022-12-25 00:16+0000\n"
1111
"PO-Revision-Date: 2018-05-23 14:41+0000\n"
1212
"Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n"
1313
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
@@ -281,7 +281,7 @@ msgstr ""
281281
msgid ""
282282
"The *stripdir*, *prependdir* and *limit_sl_dest* arguments correspond to the "
283283
"``-s``, ``-p`` and ``-e`` options described above. They may be specified as "
284-
"``str``, ``bytes`` or :py:class:`os.PathLike`."
284+
"``str`` or :py:class:`os.PathLike`."
285285
msgstr ""
286286

287287
#: ../../library/compileall.rst:204 ../../library/compileall.rst:274

0 commit comments

Comments
 (0)