Skip to content

Commit 0e64a2b

Browse files
author
github-actions
committed
Merge 3.14 into 3.12
1 parent 4f83484 commit 0e64a2b

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

whatsnew/3.14.po

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,10 +553,17 @@ msgid ""
553553
"markers), and the :attr:`~annotationlib.Format.STRING` format (which returns "
554554
"annotations as strings)."
555555
msgstr ""
556+
"新しく追加された :mod:`annotationlib` モジュールを使うことで、遅延評価となっ"
557+
"たアノテーションを取得することができます。アノテーションの評価フォーマットと"
558+
"して、 :attr:`~annotationlib.Format.VALUE` (以前のPythonバージョンと同様に、"
559+
"アノテーションの実行時の値を評価する) :attr:`~annotationlib.Format."
560+
"FORWARDREF` (未定義の名前を特別なマーカーに置き換える) :attr:"
561+
"`~annotationlib.Format.STRING` (アノテーションを文字列として返す) がありま"
562+
"す。"
556563

557564
#: ../../whatsnew/3.14.rst:387
558565
msgid "This example shows how these formats behave:"
559-
msgstr ""
566+
msgstr "各フォーマットの挙動は以下の例の通りです:"
560567

561568
#: ../../whatsnew/3.14.rst:389
562569
msgid ""
@@ -572,6 +579,17 @@ msgid ""
572579
">>> get_annotations(func, format=Format.STRING)\n"
573580
"{'arg': 'Undefined'}"
574581
msgstr ""
582+
">>> from annotationlib import get_annotations, Format\n"
583+
">>> def func(arg: Undefined):\n"
584+
"... pass\n"
585+
">>> get_annotations(func, format=Format.VALUE)\n"
586+
"Traceback (most recent call last):\n"
587+
" ...\n"
588+
"NameError: name 'Undefined' is not defined\n"
589+
">>> get_annotations(func, format=Format.FORWARDREF)\n"
590+
"{'arg': ForwardRef('Undefined', owner=<function func at 0x...>)}\n"
591+
">>> get_annotations(func, format=Format.STRING)\n"
592+
"{'arg': 'Undefined'}"
575593

576594
#: ../../whatsnew/3.14.rst:404
577595
msgid "Implications for annotated code"

0 commit comments

Comments
 (0)