@@ -866,13 +866,19 @@ msgid ""
866866"This may be of use for sync functions that return a :term:`coroutine`, if "
867867"the function is passed to an API that requires :func:`iscoroutinefunction`."
868868msgstr ""
869+ "これは、コルーチン :term:`coroutine` を返す同期関数が、 :func:"
870+ "`iscoroutinefunction` が真であることを要求するAPIに渡される場合に役に立つかも"
871+ "しれません。"
869872
870873#: ../../library/inspect.rst:447
871874msgid ""
872875"When possible, using an :keyword:`async def` function is preferred. Also "
873876"acceptable is calling the function and testing the return with :func:"
874877"`iscoroutine`."
875878msgstr ""
879+ "可能なら、 :keyword:`async def` を使った関数定義が好ましいです。また、関数を"
880+ "呼び出した上でその戻り値を :func:`iscoroutine` でテストする方法も容認できま"
881+ "す。"
876882
877883#: ../../library/inspect.rst:456
878884msgid ""
@@ -893,6 +899,7 @@ msgid ""
893899"Can also be used to distinguish generator-based coroutines from regular "
894900"generators:"
895901msgstr ""
902+ "ジェネレータベースのコルーチンと通常のジェネレータを区別するのにも使えます:"
896903
897904#: ../../library/inspect.rst:469
898905msgid ""
@@ -907,12 +914,24 @@ msgid ""
907914"assert not isawaitable(gen())\n"
908915"assert isawaitable(gen_coro())"
909916msgstr ""
917+ "import types\n"
918+ "\n"
919+ "def gen():\n"
920+ " yield\n"
921+ "@types.coroutine\n"
922+ "def gen_coro():\n"
923+ " yield\n"
924+ "\n"
925+ "assert not isawaitable(gen())\n"
926+ "assert isawaitable(gen_coro())"
910927
911928#: ../../library/inspect.rst:487
912929msgid ""
913930"Return ``True`` if the object is an :term:`asynchronous generator` function, "
914931"for example:"
915932msgstr ""
933+ "オブジェクトが非同期ジェネレータ :term:`asynchronous generator` 関数である場"
934+ "合に ``True`` を返します。使用例:"
916935
917936#: ../../library/inspect.rst:490
918937msgid ""
@@ -922,12 +941,20 @@ msgid ""
922941">>> inspect.isasyncgenfunction(agen)\n"
923942"True"
924943msgstr ""
944+ ">>> async def agen():\n"
945+ "... yield 1\n"
946+ "...\n"
947+ ">>> inspect.isasyncgenfunction(agen)\n"
948+ "True"
925949
926950#: ../../library/inspect.rst:500
927951msgid ""
928952"Functions wrapped in :func:`functools.partial` now return ``True`` if the "
929953"wrapped function is an :term:`asynchronous generator` function."
930954msgstr ""
955+ ":func:`functools.partial` でラップされた関数でも、元の関数が非同期ジェネレー"
956+ "タ :term:`asynchronous generator` 関数であれば ``True`` を返すようになりまし"
957+ "た。"
931958
932959#: ../../library/inspect.rst:510
933960msgid ""
@@ -961,12 +988,17 @@ msgstr ""
961988msgid ""
962989"Return ``True`` if the type of object is a :class:`~types.MethodWrapperType`."
963990msgstr ""
991+ "オブジェクトの型が :class:`~types.MethodWrapperType` である場合に ``True`` を"
992+ "返します。"
964993
965994#: ../../library/inspect.rst:539
966995msgid ""
967996"These are instances of :class:`~types.MethodWrapperType`, such as :meth:"
968997"`~object.__str__`, :meth:`~object.__eq__` and :meth:`~object.__repr__`."
969998msgstr ""
999+ "真を返すのは :class:`~types.MethodWrapperType` のインスタンスで、 :meth:"
1000+ "`~object.__str__`, :meth:`~object.__eq__`, :meth:`~object.__repr__` などで"
1001+ "す。"
9701002
9711003#: ../../library/inspect.rst:547
9721004msgid ""
@@ -998,6 +1030,11 @@ msgid ""
9981030"attributes varies. A :attr:`~definition.__name__` attribute is usually "
9991031"sensible, and :attr:`~definition.__doc__` often is."
10001032msgstr ""
1033+ "これはたとえば、 ``int.__add__`` で真を返します。この関数によるテストをパスす"
1034+ "る(真を返す)オブジェクトは :meth:`~object.__get__` メソッドを持ちますが、 :"
1035+ "meth:`~object.__set__` メソッドや :meth:`~object.__delete__` メソッドは持ちま"
1036+ "せん。それ以外の属性の有無はさまざまです。 :attr:`~definition.__name__` 属性"
1037+ "は普通は存在しますし、 :attr:`~definition.__doc__` 属性もしばしば見られます。"
10011038
10021039#: ../../library/inspect.rst:567
10031040msgid ""
@@ -1006,6 +1043,11 @@ msgid ""
10061043"the other tests promise more -- you can, e.g., count on having the :attr:"
10071044"`~method.__func__` attribute (etc) when an object passes :func:`ismethod`."
10081045msgstr ""
1046+ "デスクリプタによって実装されたメソッドがこのメソッド以外のテストをパスする場"
1047+ "合、 :func:`ismethoddescriptor` によるテストでは ``False`` を返します。これは"
1048+ "単純に、他のテストはより多くを約束するからです -- たとえば、あるオブジェクト"
1049+ "が :func:`ismethod` のテストをパスするとき、そのオブジェクトが :attr:"
1050+ "`~method.__func__` 属性 (など) を持っていることを期待することができます。"
10091051
10101052#: ../../library/inspect.rst:573
10111053msgid ""
@@ -1014,6 +1056,10 @@ msgid ""
10141056"being method descriptors (such objects are data descriptors, not method "
10151057"descriptors)."
10161058msgstr ""
1059+ "この関数は、 :meth:`~object.__get__` 属性と :meth:`~object.__delete__` 属性を"
1060+ "持ち、 :meth:`~object.__set__` 属性を持たないオブジェクトをメソッドデスクリプ"
1061+ "タであると不正に報告することはなくなりました (そのようなオブジェクトはデータ"
1062+ "デスクリプタであって、メソッドデスクリプタではありません)。"
10171063
10181064#: ../../library/inspect.rst:581
10191065msgid "Return ``True`` if the object is a data descriptor."
@@ -1029,6 +1075,14 @@ msgid ""
10291075"`~definition.__name__` and :attr:`!__doc__` attributes (properties, getsets, "
10301076"and members have both of these attributes), but this is not guaranteed."
10311077msgstr ""
1078+ "データデスクリプタは :attr:`~object.__set__` メソッドか :attr:`~object."
1079+ "__delete__` メソッドのいずれかを持ちます。例としては、 (Python で定義された) "
1080+ "プロパティ、 getset デスクリプタ、メンバーデスクリプタがあります。後者2つは "
1081+ "C で定義されており、それぞれの型に対して特別なテストが存在します。それらのテ"
1082+ "ストは、全ての Python 実装に対して堅牢です。概して、データデスクリプタは :"
1083+ "attr:`~definition.__name__` 属性や :attr:`!__doc__` 属性も持ちますが、このこ"
1084+ "とは保証されてはいません (一方でプロパティ、 getset デスクリプタ、メンバーデ"
1085+ "スクリプタはこれら2つの属性を両方持っています)。"
10321086
10331087#: ../../library/inspect.rst:594
10341088msgid "Return ``True`` if the object is a getset descriptor."
0 commit comments