Repository navigation
Expand file tree
/
Copy pathannotations.po
More file actions
550 lines (498 loc) · 26.1 KB
/
Copy pathannotations.po
File metadata and controls
550 lines (498 loc) · 26.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2001 Python Software Foundation
# This file is distributed under the same license as the Python package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
# Translators:
# python-doc bot, 2025
# digdugdog, 2026
# Inada Naoki <songofacandy@gmail.com>, 2026
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Python 3.15\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-11-09 23:13+0000\n"
"PO-Revision-Date: 2025-09-16 00:00+0000\n"
"Last-Translator: Inada Naoki <songofacandy@gmail.com>, 2026\n"
"Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/"
"ja/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: ja\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#: ../../howto/annotations.rst:5
msgid "Annotations Best Practices"
msgstr "アノテーションのベストプラクティス"
msgid "Abstract"
msgstr "概要"
#: ../../howto/annotations.rst:9
msgid ""
"This document is designed to encapsulate the best practices for working with "
"annotations dicts. If you write Python code that examines "
"``__annotations__`` on Python objects, we encourage you to follow the "
"guidelines described below."
msgstr ""
"このドキュメントは、アノテーションの辞書を扱う上でのベストプラクティスをまと"
"めるものです。Python オブジェクトに付与された ``__annotations__`` を Python "
"コードからアクセスする際には、以下のガイドラインに従うことを推奨します。"
#: ../../howto/annotations.rst:14
msgid ""
"The document is organized into four sections: best practices for accessing "
"the annotations of an object in Python versions 3.10 and newer, best "
"practices for accessing the annotations of an object in Python versions 3.9 "
"and older, other best practices for ``__annotations__`` that apply to any "
"Python version, and quirks of ``__annotations__``."
msgstr ""
"本ドキュメントは次の4セクションで構成されています。Python 3.10 以降でオブ"
"ジェクトのアノテーションにアクセスするときのベストプラクティス、Python 3.9 以"
"下でオブジェクトのアノテーションにアクセスするときのベストプラクティス、"
"Python バージョンに関わらない ``__annotations__`` に関するベストプラクティ"
"ス、 ``__annotations__`` の注意点、です。"
#: ../../howto/annotations.rst:24
msgid ""
"Note that this document is specifically about working with "
"``__annotations__``, not uses *for* annotations. If you're looking for "
"information on how to use \"type hints\" in your code, please see "
"the :mod:`typing` module."
msgstr ""
"注意:本ドキュメントは、アノテーションの使い方ではなく、 ``__annotations__`` "
"の使い方を扱っています。型ヒントをコードの中でどうやって使うかについて"
"は、 :mod:`typing` モジュールを参照してください。"
#: ../../howto/annotations.rst:31
msgid "Accessing The Annotations Dict Of An Object In Python 3.10 And Newer"
msgstr "オブジェクトのアノテーション辞書へのアクセス (Python 3.10 以降)"
msgid ""
"Python 3.10 adds a new function to the standard "
"library: :func:`inspect.get_annotations`. In Python versions 3.10 through "
"3.13, calling this function is the best practice for accessing the "
"annotations dict of any object that supports annotations. This function can "
"also \"un-stringize\" stringized annotations for you."
msgstr ""
"Python 3.10 で標準ライブラリに :func:`inspect.get_annotations` が追加されまし"
"た。\n"
"Python 3.10 から 3.13 では、アノテーションに対応するオブジェクトのアノテー"
"ション辞書を取得するには、この関数を呼び出すのが推奨される方法です。\n"
"この関数では、文字列化されたアノテーションを評価して元の値に戻すこともできま"
"す。"
#: ../../howto/annotations.rst:40
msgid ""
"In Python 3.14, there is a new :mod:`annotationlib` module with "
"functionality for working with annotations. This includes "
"a :func:`annotationlib.get_annotations` function, which "
"supersedes :func:`inspect.get_annotations`."
msgstr ""
"Python 3.14 では、アノテーションを扱うためのモジュール :mod:`annotationlib` "
"が追加されました。このモジュールに :func:`annotationlib.get_annotations` があ"
"り、 :func:`inspect.get_annotations` を置き換えるものです。"
#: ../../howto/annotations.rst:45
msgid ""
"If for some reason :func:`inspect.get_annotations` isn't viable for your use "
"case, you may access the ``__annotations__`` data member manually. Best "
"practice for this changed in Python 3.10 as well: as of Python 3.10, "
"``o.__annotations__`` is guaranteed to *always* work on Python functions, "
"classes, and modules. If you're certain the object you're examining is one "
"of these three *specific* objects, you may simply use ``o.__annotations__`` "
"to get at the object's annotations dict."
msgstr ""
"もし何らかの理由で自分の用途に :func:`inspect.get_annotations` が合わないとい"
"う場合は、手動で ``__annotations__`` にアクセスすることもできます。これについ"
"ても、推奨のアクセス方法が Python 3.10 で変わりました。3.10 で、 "
"``o.__annotations__`` は関数、クラス、モジュールに対しては必ず使えることが保"
"証されるようになりました。オブジェクトが確実にこの3つのいずれかである場合"
"は、単に ``o.__annotations__`` を使えばアノテーション辞書を取得できます。"
#: ../../howto/annotations.rst:55
msgid ""
"However, other types of callables--for example, callables created "
"by :func:`functools.partial`--may not have an ``__annotations__`` attribute "
"defined. When accessing the ``__annotations__`` of a possibly unknown "
"object, best practice in Python versions 3.10 and newer is to "
"call :func:`getattr` with three arguments, for example ``getattr(o, "
"'__annotations__', None)``."
msgstr ""
"しかし、それ以外の callable (例えば、 :func:`functools.partial` で作られたも"
"の) は ``__annotations__`` 属性が定義されていない可能性があります。この属性が"
"あるかどうか不明なオブジェクトの場合は、Python 3.10 以降で"
"は、 :func:`getattr` に3つの引数を渡して呼び出す (例えば ``getattr(o, "
"'__annotations__', None)`` ) のを推奨します。"
#: ../../howto/annotations.rst:63
msgid ""
"Before Python 3.10, accessing ``__annotations__`` on a class that defines no "
"annotations but that has a parent class with annotations would return the "
"parent's ``__annotations__``. In Python 3.10 and newer, the child class's "
"annotations will be an empty dict instead."
msgstr ""
"Python 3.10 より前のバージョンでは、親クラスにアノテーションがあるが自身はア"
"ノテーションを定義していないようなクラスの場合、 ``__annotations__`` を取得す"
"ると親クラスの ``__annotations__`` が返されます。3.10 以降では、代わりに空の"
"辞書が返されます。"
#: ../../howto/annotations.rst:71
msgid "Accessing The Annotations Dict Of An Object In Python 3.9 And Older"
msgstr "オブジェクトのアノテーション辞書へのアクセス (Python 3.9 以前)"
#: ../../howto/annotations.rst:73
msgid ""
"In Python 3.9 and older, accessing the annotations dict of an object is much "
"more complicated than in newer versions. The problem is a design flaw in "
"these older versions of Python, specifically to do with class annotations."
msgstr ""
"Python 3.9 以前では、オブジェクトのアノテーション辞書を取得するのはより複雑で"
"す。原因は、3.9 以前のバージョンの設計上の欠陥 (具体的にはクラスのアノテー"
"ション) です。"
#: ../../howto/annotations.rst:78
msgid ""
"Best practice for accessing the annotations dict of other objects--"
"functions, other callables, and modules--is the same as best practice for "
"3.10, assuming you aren't calling :func:`inspect.get_annotations`: you "
"should use three-argument :func:`getattr` to access the object's "
"``__annotations__`` attribute."
msgstr ""
"クラス以外のオブジェクト (関数や他の callable、モジュール) のアノテーションを"
"取得する推奨の方法は、3.10と同じです。 :func:`inspect.get_annotations` ではな"
"く、 :func:`getattr` に3つの引数を渡すことで ``__annotations__`` 属性を取得"
"するのがいいです。"
#: ../../howto/annotations.rst:85
msgid ""
"Unfortunately, this isn't best practice for classes. The problem is that, "
"since ``__annotations__`` is optional on classes, and because classes can "
"inherit attributes from their base classes, accessing the "
"``__annotations__`` attribute of a class may inadvertently return the "
"annotations dict of a *base class.* As an example::"
msgstr ""
"ただし、クラスについては推奨方法が異なります。なぜなら、クラスには "
"``__annotations__`` は必須ではなく、属性はベースクラスから継承されるので、 "
"``__annotations__`` 属性にアクセスするとベースクラスのアノテーション辞書を取"
"得してしまうという問題があるからです。例えば::"
#: ../../howto/annotations.rst:92
msgid ""
"class Base:\n"
" a: int = 3\n"
" b: str = 'abc'\n"
"\n"
"class Derived(Base):\n"
" pass\n"
"\n"
"print(Derived.__annotations__)"
msgstr ""
"class Base:\n"
" a: int = 3\n"
" b: str = 'abc'\n"
"\n"
"class Derived(Base):\n"
" pass\n"
"\n"
"print(Derived.__annotations__)"
#: ../../howto/annotations.rst:101
msgid "This will print the annotations dict from ``Base``, not ``Derived``."
msgstr ""
"このコードでは ``Derived`` ではなく ``Base`` のアノテーションが表示されます。"
#: ../../howto/annotations.rst:104
msgid ""
"Your code will have to have a separate code path if the object you're "
"examining is a class (``isinstance(o, type)``). In that case, best practice "
"relies on an implementation detail of Python 3.9 and before: if a class has "
"annotations defined, they are stored in the class's :attr:`~type.__dict__` "
"dictionary. Since the class may or may not have annotations defined, best "
"practice is to call the :meth:`~dict.get` method on the class dict."
msgstr ""
"クラス (``isinstance(o, type)``) のアノテーションを取得するためには、新たに分"
"岐を追加する必要があります。推奨する方法では、 Python 3.9 以前の実装に依存し"
"た方法をとります。クラスにアノテーションがあれば、 :attr:`~type.__dict__` の"
"辞書に格納されるという実装になっています。クラスにはアノテーションがない場合"
"もあるため、この辞書の :meth:`~dict.get` メソッドを使ってアノテーションを取得"
"する、というのが推奨の方法です。"
#: ../../howto/annotations.rst:112
msgid ""
"To put it all together, here is some sample code that safely accesses the "
"``__annotations__`` attribute on an arbitrary object in Python 3.9 and "
"before::"
msgstr ""
"以上を踏まえると、Python 3.9 以前では、以下のサンプルコードで任意のオブジェク"
"トの ``__annotations__`` 属性を安全に取得することができます::"
#: ../../howto/annotations.rst:116
msgid ""
"if isinstance(o, type):\n"
" ann = o.__dict__.get('__annotations__', None)\n"
"else:\n"
" ann = getattr(o, '__annotations__', None)"
msgstr ""
"if isinstance(o, type):\n"
" ann = o.__dict__.get('__annotations__', None)\n"
"else:\n"
" ann = getattr(o, '__annotations__', None)"
#: ../../howto/annotations.rst:121
msgid ""
"After running this code, ``ann`` should be either a dictionary or ``None``. "
"You're encouraged to double-check the type of ``ann`` "
"using :func:`isinstance` before further examination."
msgstr ""
"このコードを実行すると、 ``ann`` の値は辞書か ``None`` となります。さらに "
"``ann`` の値を調べるには、 :func:`isinstance` で型を再度確認することを推奨し"
"ます。"
#: ../../howto/annotations.rst:126
msgid ""
"Note that some exotic or malformed type objects may not have "
"a :attr:`~type.__dict__` attribute, so for extra safety you may also wish to "
"use :func:`getattr` to access :attr:`!__dict__`."
msgstr ""
"ただし、一部の特殊な型オブジェクトや不正な形式の型オブジェクト"
"は :attr:`~type.__dict__` 属性がないこともあるため、さらに安全をとるに"
"は :func:`getattr` を使って :attr:`!__dict__` を取得したほうがいいです。"
#: ../../howto/annotations.rst:132
msgid "Manually Un-Stringizing Stringized Annotations"
msgstr "文字列指定のアノテーションを手動で解決する方法"
#: ../../howto/annotations.rst:134
msgid ""
"In situations where some annotations may be \"stringized\", and you wish to "
"evaluate those strings to produce the Python values they represent, it "
"really is best to call :func:`inspect.get_annotations` to do this work for "
"you."
msgstr ""
"アノテーションは文字列として指定されている場合があり、それを評価して Python "
"の値に変換するには、 :func:`inspect.get_annotations` を使うのが一番です。"
#: ../../howto/annotations.rst:140
msgid ""
"If you're using Python 3.9 or older, or if for some reason you can't "
"use :func:`inspect.get_annotations`, you'll need to duplicate its logic. "
"You're encouraged to examine the implementation "
"of :func:`inspect.get_annotations` in the current Python version and follow "
"a similar approach."
msgstr ""
"Python 3.9 以前を使っているか、もしくは何らかの理由"
"で :func:`inspect.get_annotations` を使えない場合は、自分で実装する必要があり"
"ます。現状の Python バージョンの :func:`inspect.get_annotations` の実装を確認"
"して、同様の処理を実装することを推奨します。"
#: ../../howto/annotations.rst:146
msgid ""
"In a nutshell, if you wish to evaluate a stringized annotation on an "
"arbitrary object ``o``:"
msgstr ""
"すなわち、任意のオブジェクト ``o`` の文字列アノテーションを評価するには:"
#: ../../howto/annotations.rst:149
msgid ""
"If ``o`` is a module, use ``o.__dict__`` as the ``globals`` when "
"calling :func:`eval`."
msgstr ""
"``o`` がモジュールならば、 ``o.__dict__`` を ``globals`` として :func:`eval` "
"を呼ぶ。"
#: ../../howto/annotations.rst:151
msgid ""
"If ``o`` is a class, use ``sys.modules[o.__module__].__dict__`` as the "
"``globals``, and ``dict(vars(o))`` as the ``locals``, when "
"calling :func:`eval`."
msgstr ""
"``o`` がクラスならば、 ``sys.modules[o.__module__].__dict__`` を ``globals`` "
"とし、 ``dict(vars(o))`` を ``locals`` として :func:`eval` を呼ぶ。"
msgid ""
"If ``o`` is a wrapped callable "
"using :func:`functools.update_wrapper`, :deco:`functools.wraps`, "
"or :func:`functools.partial`, iteratively unwrap it by accessing either "
"``o.__wrapped__`` or ``o.func`` as appropriate, until you have found the "
"root unwrapped function."
msgstr ""
"``o`` が :func:`functools.update_wrapper`、:deco:`functools.wraps`、また"
"は :func:`functools.partial` でラップされた呼び出し可能オブジェクトなら、適切"
"なほうの ``o.__wrapped__`` または ``o.func`` を繰り返し参照し、ラップされてい"
"ない元の関数までたどります。"
#: ../../howto/annotations.rst:158
msgid ""
"If ``o`` is a callable (but not a class), use :attr:`o.__globals__ "
"<function.__globals__>` as the globals when calling :func:`eval`."
msgstr ""
"``o`` がクラス以外の callable であれば、 :attr:`o.__globals__ "
"<function.__globals__>` を globals として :func:`eval` を呼ぶ。"
#: ../../howto/annotations.rst:162
msgid ""
"However, not all string values used as annotations can be successfully "
"turned into Python values by :func:`eval`. String values could theoretically "
"contain any valid string, and in practice there are valid use cases for type "
"hints that require annotating with string values that specifically *can't* "
"be evaluated. For example:"
msgstr ""
"しかし、必ずしもアノテーションの文字列が :func:`eval` で Python の値に変換で"
"きるとは限りません。理論上どんな文字列も指定可能であり、変換できない文字列を"
"型ヒントとして指定する必要がある場合が実際にあります。例えば:"
msgid ""
":pep:`604` union types using ``|``, before support for this was added to "
"Python 3.10."
msgstr ""
"``|`` を使った :pep:`604` の Union型 (これが追加された Python 3.10 より前の"
"バージョン)"
#: ../../howto/annotations.rst:171
msgid ""
"Definitions that aren't needed at runtime, only imported "
"when :const:`typing.TYPE_CHECKING` is true."
msgstr ""
":const:`typing.TYPE_CHECKING` が True の時だけインポートされ、実行時には必要"
"ない型定義。"
#: ../../howto/annotations.rst:174
msgid ""
"If :func:`eval` attempts to evaluate such values, it will fail and raise an "
"exception. So, when designing a library API that works with annotations, "
"it's recommended to only attempt to evaluate string values when explicitly "
"requested to by the caller."
msgstr ""
":func:`eval` で上記のような値を評価しようとすると、失敗し例外が発生します。そ"
"のため、アノテーションを扱うライブラリ API を作る際は、呼び出し側が明示的に要"
"求したときのみ、文字列を評価することが推奨されます。"
#: ../../howto/annotations.rst:182
msgid "Best Practices For ``__annotations__`` In Any Python Version"
msgstr "``__annotations__`` のベストプラクティス (全 Python バージョン共通)"
msgid ""
"You should avoid assigning to the ``__annotations__`` member of objects "
"directly. Let Python manage setting ``__annotations__``."
msgstr ""
"オブジェクトの ``__annotations__`` 属性に直接代入することは避けるべきです。"
"Python に任せましょう。"
#: ../../howto/annotations.rst:187
msgid ""
"If you do assign directly to the ``__annotations__`` member of an object, "
"you should always set it to a ``dict`` object."
msgstr ""
"直接 ``__annotations__`` 属性に代入するなら、必ず ``dict`` オブジェクトを代入"
"するべきです。"
#: ../../howto/annotations.rst:190
msgid ""
"You should avoid accessing ``__annotations__`` directly on any object. "
"Instead, use :func:`annotationlib.get_annotations` (Python 3.14+) "
"or :func:`inspect.get_annotations` (Python 3.10+)."
msgstr ""
"どういうオブジェクトかに関わらず、直接 ``__annotations__`` にアクセスするのは"
"避けるべきです。Python 3.14 以降は :func:`annotationlib.get_annotations` 、 "
"Python 3.10 以降は :func:`inspect.get_annotations` を使いましょう。"
#: ../../howto/annotations.rst:194
msgid ""
"If you do directly access the ``__annotations__`` member of an object, you "
"should ensure that it's a dictionary before attempting to examine its "
"contents."
msgstr ""
"直接 ``__annotations__`` メンバーにアクセスするなら、まず値が辞書であることを"
"チェックしてから中身を調べるべきです。"
#: ../../howto/annotations.rst:198
msgid "You should avoid modifying ``__annotations__`` dicts."
msgstr "``__annotations__`` 辞書を書き換えるのは避けるべきです。"
#: ../../howto/annotations.rst:200
msgid ""
"You should avoid deleting the ``__annotations__`` attribute of an object."
msgstr "``__annotations__`` 属性を削除するのは避けるべきです。"
#: ../../howto/annotations.rst:205
msgid "``__annotations__`` Quirks"
msgstr "``__annotations__`` の注意点"
#: ../../howto/annotations.rst:207
msgid ""
"In all versions of Python 3, function objects lazy-create an annotations "
"dict if no annotations are defined on that object. You can delete the "
"``__annotations__`` attribute using ``del fn.__annotations__``, but if you "
"then access ``fn.__annotations__`` the object will create a new empty dict "
"that it will store and return as its annotations. Deleting the annotations "
"on a function before it has lazily created its annotations dict will throw "
"an ``AttributeError``; using ``del fn.__annotations__`` twice in a row is "
"guaranteed to always throw an ``AttributeError``."
msgstr ""
#: ../../howto/annotations.rst:217
msgid ""
"Everything in the above paragraph also applies to class and module objects "
"in Python 3.10 and newer."
msgstr ""
msgid ""
"In all versions of Python 3, you can set ``__annotations__`` on a function "
"object to ``None``. However, subsequently accessing the annotations on that "
"object using ``fn.__annotations__`` will lazy-create an empty dictionary as "
"per the first paragraph of this section. This is *not* true of modules and "
"classes, in any Python version; those objects permit setting "
"``__annotations__`` to any Python value, and will retain whatever value is "
"set."
msgstr ""
"Python 3 のすべてのバージョンで、関数オブジェクトの ``__annotations__`` に "
"``None`` を設定できます。\n"
"ただし、その後 ``fn.__annotations__`` でアクセスすると、この節の最初の段落で"
"述べたとおり、空の辞書が遅延作成されます。\n"
"これは、どの Python バージョンでもモジュールやクラスには *当てはまりません"
"*。\n"
"これらのオブジェクトでは、``__annotations__`` に任意の Python の値を設定で"
"き、設定した値がそのまま保持されます。"
msgid ""
"If Python stringizes your annotations for you (using ``from __future__ "
"import annotations``), and you specify a string as an annotation, the string "
"will itself be quoted. In effect the annotation is quoted *twice.* For "
"example::"
msgstr ""
"``from __future__ import annotations`` を使って Python にアノテーションを文字"
"列化させる場合に、アノテーションとして文字列を指定すると、その文字列自体が引"
"用符で囲まれます。\n"
"つまり、アノテーションが *二重に* 引用されます。\n"
"例えば、次のようになります。 ::"
msgid ""
"from __future__ import annotations\n"
"def foo(a: \"str\"): pass\n"
"\n"
"print(foo.__annotations__)"
msgstr ""
"from __future__ import annotations\n"
"def foo(a: \"str\"): pass\n"
"\n"
"print(foo.__annotations__)"
msgid ""
"This prints ``{'a': \"'str'\"}``. This shouldn't really be considered a "
"\"quirk\"; it's mentioned here simply because it might be surprising."
msgstr ""
"これは ``{'a': \"'str'\"}`` を表示します。\n"
"本来は「癖」と呼ぶような動作ではありませんが、意外に感じるかもしれないため、"
"ここで紹介しています。"
msgid ""
"If you use a class with a custom metaclass and access ``__annotations__`` on "
"the class, you may observe unexpected behavior; see :pep:`749 <749#pep749-"
"metaclasses>` for some examples. You can avoid these quirks by "
"using :func:`annotationlib.get_annotations` on Python 3.14+ "
"or :func:`inspect.get_annotations` on Python 3.10+."
msgstr ""
"独自のメタクラスを持つクラスで ``__annotations__`` にアクセスすると、予期しな"
"い動作が起こる場合があります。\n"
"例については :pep:`749 <749#pep749-metaclasses>` を参照してください。\n"
"Python 3.14 以降では :func:`annotationlib.get_annotations`、Python 3.10 以降"
"では :func:`inspect.get_annotations` を使うことで、このような動作を避けられま"
"す。"
msgid ""
"On Python 3.14 and later, annotations are evaluated lazily (see :pep:`649` "
"and :pep:`749`), and how the annotations dict is stored in the "
"class's :attr:`~type.__dict__` is a private implementation detail. Reading "
"``cls.__dict__.get('__annotations__', None)`` may therefore return ``None`` "
"even when the class has annotations. On these versions, always "
"use :func:`annotationlib.get_annotations` "
"(or :func:`inspect.get_annotations`) rather than "
"accessing :attr:`~type.__dict__` directly."
msgstr ""
"Python 3.14 以降ではアノテーションは遅延評価されます (:pep:`649` "
"と :pep:`749` を参照)。\n"
"アノテーションの辞書をクラスの :attr:`~type.__dict__` にどのように格納するか"
"は、非公開の実装詳細です。\n"
"そのため、クラスにアノテーションがあっても "
"``cls.__dict__.get('__annotations__', None)`` が ``None`` を返す場合がありま"
"す。\n"
"これらのバージョンでは :attr:`~type.__dict__` に直接アクセスせず、必"
"ず :func:`annotationlib.get_annotations` (また"
"は :func:`inspect.get_annotations`) を使ってください。"
msgid ""
"Only on Python 3.9 and earlier, where neither function is available, can you "
"avoid these bugs by reading the annotations from the "
"class's :attr:`~type.__dict__` (for example, "
"``cls.__dict__.get('__annotations__', None)``)."
msgstr ""
"どちらの関数も利用できない Python 3.9 以前に限り、クラス"
"の :attr:`~type.__dict__` からアノテーションを読み取ることで (例えば "
"``cls.__dict__.get('__annotations__', None)``)、これらのバグを回避できます。"
msgid ""
"In some versions of Python, instances of classes may have an "
"``__annotations__`` attribute. However, this is not supported functionality. "
"If you need the annotations of an instance, you can use :func:`type` to "
"access its class (for example, "
"``annotationlib.get_annotations(type(myinstance))`` on Python 3.14+)."
msgstr ""
"一部の Python バージョンでは、クラスのインスタンスが ``__annotations__`` 属性"
"を持つことがあります。\n"
"ただし、これはサポートされている機能ではありません。\n"
"インスタンスのアノテーションが必要なら、:func:`type` でそのクラスを取得できま"
"す。\n"
"例えば、Python 3.14 以降では "
"``annotationlib.get_annotations(type(myinstance))`` を使えます。"