Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb2a9580

Browse files
github-actions[bot]mattwang44
authored andcommitted
sync with cpython e3281152
1 parent024abe8 commitb2a9580

File tree

15 files changed

+2026
-1997
lines changed

15 files changed

+2026
-1997
lines changed

‎c-api/function.po

Lines changed: 44 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ msgid ""
1010
msgstr ""
1111
"Project-Id-Version:Python 3.12\n"
1212
"Report-Msgid-Bugs-To:\n"
13-
"POT-Creation-Date:2023-12-07 00:03+0000\n"
13+
"POT-Creation-Date:2023-12-13 00:03+0000\n"
1414
"PO-Revision-Date:2022-11-12 15:45+0800\n"
1515
"Last-Translator:Matt Wang <mattwang44@gmail.com>\n"
1616
"Language-Team:Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
@@ -62,153 +62,159 @@ msgstr ""
6262
"夠存取的全域變數的字典。"
6363

6464
#:../../c-api/function.rst:37
65+
#,fuzzy
6566
msgid""
66-
"The function's docstring and name are retrieved from the code object. "
67-
"*__module__* is retrieved from *globals*. The argument defaults, annotations "
68-
"and closure are set to ``NULL``. *__qualname__* is set to the same value as "
69-
"the code object's :attr:`~codeobject.co_qualname` field."
67+
"The function's docstring and name are retrieved from the code object. :attr:"
68+
"`~function.__module__` is retrieved from *globals*. The argument defaults, "
69+
"annotations and closure are set to ``NULL``. :attr:`~function.__qualname__` "
70+
"is set to the same value as the code object's :attr:`~codeobject."
71+
"co_qualname` field."
7072
msgstr""
7173
"函式的文件字串 (docstring) 和名稱是從程式碼物件所取得,*__module__* 是自 "
7274
"*globals* 所取得。引數預設值、標註 (annotation) 和閉包 (closure) 被設為 "
7375
"``NULL``,*__qualname__* 被設為和程式碼物件 :attr:`~codeobject.co_qualname` "
7476
"欄位相同的值。"
7577

76-
#:../../c-api/function.rst:45
78+
#:../../c-api/function.rst:46
79+
#,fuzzy
7780
msgid""
78-
"As :c:func:`PyFunction_New`, but also allows setting the function object's "
79-
"``__qualname__`` attribute.*qualname* should be a unicode object or "
80-
"``NULL``; if ``NULL``, the``__qualname__`` attribute is set to the same "
81-
"value as the code object's :attr:`~codeobject.co_qualname` field."
81+
"As :c:func:`PyFunction_New`, but also allows setting the function object's:"
82+
"attr:`~function.__qualname__` attribute. *qualname* should be a unicode "
83+
"object or``NULL``; if ``NULL``, the:attr:`!__qualname__` attribute is set "
84+
"to the samevalue as the code object's :attr:`~codeobject.co_qualname` field."
8285
msgstr""
8386
"和 :c:func:`PyFunction_New` 相似,但也允許函式物件 ``__qualname__`` 屬性的設"
8487
"定,*qualname* 應為一個 unicode 物件或是 ``NULL``;如為 ``NULL``,"
8588
"``__qualname__`` 屬性會被設為與程式碼物件 :attr:`~codeobject.co_qualname` 欄"
8689
"位相同的值。"
8790

88-
#:../../c-api/function.rst:55
91+
#:../../c-api/function.rst:57
8992
msgid"Return the code object associated with the function object *op*."
9093
msgstr"回傳與程式碼物件相關的函式物件 *op*。"
9194

92-
#:../../c-api/function.rst:60
95+
#:../../c-api/function.rst:62
9396
msgid"Return the globals dictionary associated with the function object *op*."
9497
msgstr"回傳與全域函式字典相關的函式物件 *op*。"
9598

96-
#:../../c-api/function.rst:65
99+
#:../../c-api/function.rst:67
100+
#,fuzzy
97101
msgid""
98-
"Return a :term:`borrowed reference` to the *__module__* attribute of the "
99-
"function object *op*. It can be *NULL*."
102+
"Return a :term:`borrowed reference` to the :attr:`~function.__module__` "
103+
"attribute of the :ref:`function object <user-defined-funcs>` *op*. It can be "
104+
"*NULL*."
100105
msgstr""
101106
"回傳一個函式物件 *op* 之 *__module__* 屬性的 :term:`borrowed reference`,它可"
102107
"以是 *NULL*。"
103108

104-
#:../../c-api/function.rst:68
109+
#:../../c-api/function.rst:71
110+
#,fuzzy
105111
msgid""
106-
"This is normally a string containing the module name, but can be set to any "
107-
"other object by Python code."
112+
"This is normally a:class:`string<str>`containing the module name, but can "
113+
"be set to anyother object by Python code."
108114
msgstr"這通常是個包含模組名稱的字串,但可以被 Python 程式設為任何其他物件。"
109115

110-
#:../../c-api/function.rst:74
116+
#:../../c-api/function.rst:77
111117
msgid""
112118
"Return the argument default values of the function object *op*. This can be "
113119
"a tuple of arguments or ``NULL``."
114120
msgstr""
115121
"回傳函式物件 *op* 的引數預設值,這可以是一個含有多個引數的 tuple(元組)或 "
116122
"``NULL``。"
117123

118-
#:../../c-api/function.rst:80
124+
#:../../c-api/function.rst:83
119125
msgid""
120126
"Set the argument default values for the function object *op*. *defaults* "
121127
"must be ``Py_None`` or a tuple."
122128
msgstr""
123129
"設定函式物件 *op* 的引數預設值。*defaults* 必須是 ``Py_None`` 或一個 tuple。"
124130

125-
#:../../c-api/function.rst:83../../c-api/function.rst:106
126-
#:../../c-api/function.rst:120
131+
#:../../c-api/function.rst:86../../c-api/function.rst:109
132+
#:../../c-api/function.rst:123
127133
msgid"Raises :exc:`SystemError` and returns ``-1`` on failure."
128134
msgstr"引發 :exc:`SystemError` 且在失敗時回傳 ``-1``。"
129135

130-
#:../../c-api/function.rst:88
136+
#:../../c-api/function.rst:91
131137
msgid"Set the vectorcall field of a given function object *func*."
132138
msgstr"為一個給定的函式物件 *func* 設定 vectorcall 欄位。"
133139

134-
#:../../c-api/function.rst:90
140+
#:../../c-api/function.rst:93
135141
msgid""
136142
"Warning: extensions using this API must preserve the behavior of the "
137143
"unaltered (default) vectorcall function!"
138144
msgstr""
139145

140-
#:../../c-api/function.rst:97
146+
#:../../c-api/function.rst:100
141147
msgid""
142148
"Return the closure associated with the function object *op*. This can be "
143149
"``NULL`` or a tuple of cell objects."
144150
msgstr""
145151
"回傳與函式物件 *op* 相關聯的閉包,這可以是個 ``NULL`` 或是一個包含 cell 物件"
146152
"的 tuple。"
147153

148-
#:../../c-api/function.rst:103
154+
#:../../c-api/function.rst:106
149155
msgid""
150156
"Set the closure associated with the function object *op*. *closure* must be "
151157
"``Py_None`` or a tuple of cell objects."
152158
msgstr""
153159
"設定與函式物件 *op* 相關聯的閉包,*closure* 必須是 ``Py_None`` 或是一個包含 "
154160
"cell 物件的 tuple。"
155161

156-
#:../../c-api/function.rst:111
162+
#:../../c-api/function.rst:114
157163
msgid""
158164
"Return the annotations of the function object *op*. This can be a mutable "
159165
"dictionary or ``NULL``."
160166
msgstr""
161167
"回傳函式物件 *op* 的標註,這可以是一個可變動的 (mutable) 字典或 ``NULL``。"
162168

163-
#:../../c-api/function.rst:117
169+
#:../../c-api/function.rst:120
164170
msgid""
165171
"Set the annotations for the function object *op*. *annotations* must be a "
166172
"dictionary or ``Py_None``."
167173
msgstr"設定函式物件 *op* 的標註,*annotations* 必須是一個字典或 ``Py_None``。"
168174

169-
#:../../c-api/function.rst:125
175+
#:../../c-api/function.rst:128
170176
msgid""
171177
"Register *callback* as a function watcher for the current interpreter. "
172178
"Return an ID which may be passed to :c:func:`PyFunction_ClearWatcher`. In "
173179
"case of error (e.g. no more watcher IDs available), return ``-1`` and set an "
174180
"exception."
175181
msgstr""
176182

177-
#:../../c-api/function.rst:135
183+
#:../../c-api/function.rst:138
178184
msgid""
179185
"Clear watcher identified by *watcher_id* previously returned from :c:func:"
180186
"`PyFunction_AddWatcher` for the current interpreter. Return ``0`` on "
181187
"success, or ``-1`` and set an exception on error (e.g. if the given "
182188
"*watcher_id* was never registered.)"
183189
msgstr""
184190

185-
#:../../c-api/function.rst:145
191+
#:../../c-api/function.rst:148
186192
msgid""
187193
"Enumeration of possible function watcher events: - "
188194
"``PyFunction_EVENT_CREATE`` - ``PyFunction_EVENT_DESTROY`` - "
189195
"``PyFunction_EVENT_MODIFY_CODE`` - ``PyFunction_EVENT_MODIFY_DEFAULTS`` - "
190196
"``PyFunction_EVENT_MODIFY_KWDEFAULTS``"
191197
msgstr""
192198

193-
#:../../c-api/function.rst:157
199+
#:../../c-api/function.rst:160
194200
msgid"Type of a function watcher callback function."
195201
msgstr""
196202

197-
#:../../c-api/function.rst:159
203+
#:../../c-api/function.rst:162
198204
msgid""
199205
"If *event* is ``PyFunction_EVENT_CREATE`` or ``PyFunction_EVENT_DESTROY`` "
200206
"then *new_value* will be ``NULL``. Otherwise, *new_value* will hold a :term:"
201207
"`borrowed reference` to the new value that is about to be stored in *func* "
202208
"for the attribute that is being modified."
203209
msgstr""
204210

205-
#:../../c-api/function.rst:164
211+
#:../../c-api/function.rst:167
206212
msgid""
207213
"The callback may inspect but must not modify *func*; doing so could have "
208214
"unpredictable effects, including infinite recursion."
209215
msgstr""
210216

211-
#:../../c-api/function.rst:167
217+
#:../../c-api/function.rst:170
212218
msgid""
213219
"If *event* is ``PyFunction_EVENT_CREATE``, then the callback is invoked "
214220
"after `func` has been fully initialized. Otherwise, the callback is invoked "
@@ -220,22 +226,22 @@ msgid ""
220226
"semantics of the Python code being executed."
221227
msgstr""
222228

223-
#:../../c-api/function.rst:176
229+
#:../../c-api/function.rst:179
224230
msgid""
225231
"If *event* is ``PyFunction_EVENT_DESTROY``, Taking a reference in the "
226232
"callback to the about-to-be-destroyed function will resurrect it, preventing "
227233
"it from being freed at this time. When the resurrected object is destroyed "
228234
"later, any watcher callbacks active at that time will be called again."
229235
msgstr""
230236

231-
#:../../c-api/function.rst:181
237+
#:../../c-api/function.rst:184
232238
msgid""
233239
"If the callback sets an exception, it must return ``-1``; this exception "
234240
"will be printed as an unraisable exception using :c:func:"
235241
"`PyErr_WriteUnraisable`. Otherwise it should return ``0``."
236242
msgstr""
237243

238-
#:../../c-api/function.rst:185
244+
#:../../c-api/function.rst:188
239245
msgid""
240246
"There may already be a pending exception set on entry to the callback. In "
241247
"this case, the callback should return ``0`` with the same exception still "

‎howto/annotations.po

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ msgid ""
77
msgstr ""
88
"Project-Id-Version:Python 3.12\n"
99
"Report-Msgid-Bugs-To:\n"
10-
"POT-Creation-Date:2022-12-25 00:16+0000\n"
10+
"POT-Creation-Date:2023-12-13 00:03+0000\n"
1111
"PO-Revision-Date:2023-11-08 23:11+0800\n"
1212
"Last-Translator:rockleon <therockleona@gmail.com>\n"
1313
"Language-Team:Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
@@ -271,14 +271,15 @@ msgstr ""
271271
"__wrapped__`` 或 ``o.func`` 來疊代解開它,直到找到根解包函式。"
272272

273273
#:../../howto/annotations.rst:155
274+
#,fuzzy
274275
msgid""
275-
"If ``o`` is a callable (but not a class), use``o.__globals__`` as the"
276-
"globals when calling :func:`eval`."
276+
"If ``o`` is a callable (but not a class), use:attr:`o.__globals__ <function."
277+
"__globals__>` as theglobals when calling :func:`eval`."
277278
msgstr""
278279
"如果 ``o`` 是 callable(但不是類別),則在呼叫 :func:`eval` 時使用 ``o."
279280
"__globals__`` 作為全域變數。"
280281

281-
#:../../howto/annotations.rst:158
282+
#:../../howto/annotations.rst:159
282283
msgid""
283284
"However, not all string values used as annotations can be successfully "
284285
"turned into Python values by :func:`eval`. String values could theoretically "
@@ -290,21 +291,21 @@ msgstr ""
290291
"理論上,字串值可以包含任何有效的字串,並且在實踐中,型別提示存在有效的用例,"
291292
"需要使用特定「無法」評估的字串值進行註釋。例如: ::"
292293

293-
#:../../howto/annotations.rst:165
294+
#:../../howto/annotations.rst:166
294295
msgid""
295296
":pep:`604` union types using ``|``, before support for this was added to "
296297
"Python 3.10."
297298
msgstr""
298299
"在 Python 3.10 支援 :pep:`604` 聯合型別 (union type) ``|`` 之前使用它。"
299300

300-
#:../../howto/annotations.rst:167
301+
#:../../howto/annotations.rst:168
301302
msgid""
302303
"Definitions that aren't needed at runtime, only imported when :const:`typing."
303304
"TYPE_CHECKING` is true."
304305
msgstr""
305306
"Runtime 中不需要的定義,僅在 :const:`typing.TYPE_CHECKING` 為 true 時匯入。"
306307

307-
#:../../howto/annotations.rst:170
308+
#:../../howto/annotations.rst:171
308309
msgid""
309310
"If :func:`eval` attempts to evaluate such values, it will fail and raise an "
310311
"exception. So, when designing a library API that works with annotations, "
@@ -314,27 +315,27 @@ msgstr ""
314315
"如果 :func:`eval` 嘗試計算這類型的值,它將失敗並引發例外。因此,在設計使用註"
315316
"釋的函式庫 API 時,建議僅在呼叫者 (caller) 明確請求時嘗試評估字串值。"
316317

317-
#:../../howto/annotations.rst:178
318+
#:../../howto/annotations.rst:179
318319
msgid"Best Practices For ``__annotations__`` In Any Python Version"
319320
msgstr"任何 Python 版本中 ``__annotations__`` 的最佳實踐"
320321

321-
#:../../howto/annotations.rst:180
322+
#:../../howto/annotations.rst:181
322323
msgid""
323324
"You should avoid assigning to the ``__annotations__`` member of objects "
324325
"directly. Let Python manage setting ``__annotations__``."
325326
msgstr""
326327
"你應該避免直接指派給物件的 ``__annotations__`` 成員。讓 Python 管理設定 "
327328
"``__annotations__``。"
328329

329-
#:../../howto/annotations.rst:183
330+
#:../../howto/annotations.rst:184
330331
msgid""
331332
"If you do assign directly to the ``__annotations__`` member of an object, "
332333
"you should always set it to a ``dict`` object."
333334
msgstr""
334335
"如果你直接指派給物件的 ``__annotations__`` 成員,則應始終將其設為 ``dict`` 物"
335336
"件。"
336337

337-
#:../../howto/annotations.rst:186
338+
#:../../howto/annotations.rst:187
338339
msgid""
339340
"If you directly access the ``__annotations__`` member of an object, you "
340341
"should ensure that it's a dictionary before attempting to examine its "
@@ -343,20 +344,20 @@ msgstr ""
343344
"如果直接存取物件的 ``__annotations__`` 成員,則應在嘗試檢查其內容之前確保它是"
344345
"字典。"
345346

346-
#:../../howto/annotations.rst:190
347+
#:../../howto/annotations.rst:191
347348
msgid"You should avoid modifying ``__annotations__`` dicts."
348349
msgstr"你應該避免修改 ``__annotations__`` 字典。"
349350

350-
#:../../howto/annotations.rst:192
351+
#:../../howto/annotations.rst:193
351352
msgid""
352353
"You should avoid deleting the ``__annotations__`` attribute of an object."
353354
msgstr"你應該避免刪除物件的 ``__annotations__`` 屬性。"
354355

355-
#:../../howto/annotations.rst:197
356+
#:../../howto/annotations.rst:198
356357
msgid"``__annotations__`` Quirks"
357358
msgstr"``__annotations__`` 奇異之處"
358359

359-
#:../../howto/annotations.rst:199
360+
#:../../howto/annotations.rst:200
360361
msgid""
361362
"In all versions of Python 3, function objects lazy-create an annotations "
362363
"dict if no annotations are defined on that object. You can delete the "
@@ -374,13 +375,13 @@ msgstr ""
374375
"上的註釋將拋出 ``AttributeError``;連續兩次使用 ``del fn.__annotations__`` 保"
375376
"證總是拋出 ``AttributeError`` 。"
376377

377-
#:../../howto/annotations.rst:209
378+
#:../../howto/annotations.rst:210
378379
msgid""
379380
"Everything in the above paragraph also applies to class and module objects "
380381
"in Python 3.10 and newer."
381382
msgstr"上一段的所有內容也適用於 Python 3.10 及更高版本中的類別和模組物件。"
382383

383-
#:../../howto/annotations.rst:212
384+
#:../../howto/annotations.rst:213
384385
msgid""
385386
"In all versions of Python 3, you can set ``__annotations__`` on a function "
386387
"object to ``None``. However, subsequently accessing the annotations on that "
@@ -396,7 +397,7 @@ msgstr ""
396397
"\\ *並非如此*\\;這些物件允許將 ``__annotations__`` 設定為任何 Python 值,並"
397398
"且將保留設定的任何值。"
398399

399-
#:../../howto/annotations.rst:220
400+
#:../../howto/annotations.rst:221
400401
msgid""
401402
"If Python stringizes your annotations for you (using ``from __future__ "
402403
"import annotations``), and you specify a string as an annotation, the string "
@@ -407,7 +408,7 @@ msgstr ""
407408
"annotations``),並且你指定一個字串作為註釋,則該字串本身將被引用。實際上,註"
408409
"釋被引用了\\ *兩次。*\\ 例如: ::"
409410

410-
#:../../howto/annotations.rst:231
411+
#:../../howto/annotations.rst:232
411412
msgid""
412413
"This prints ``{'a':\"'str'\"}``. This shouldn't really be considered a "
413414
"\"quirk\"; it's mentioned here simply because it might be surprising."

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp