@@ -866,13 +866,19 @@ msgid ""
866
866
"This may be of use for sync functions that return a :term:`coroutine`, if "
867
867
"the function is passed to an API that requires :func:`iscoroutinefunction`."
868
868
msgstr ""
869
+ "これは、コルーチン :term:`coroutine` を返す同期関数が、 :func:"
870
+ "`iscoroutinefunction` が真であることを要求するAPIに渡される場合に役に立つかも"
871
+ "しれません。"
869
872
870
873
#: ../../library/inspect.rst:447
871
874
msgid ""
872
875
"When possible, using an :keyword:`async def` function is preferred. Also "
873
876
"acceptable is calling the function and testing the return with :func:"
874
877
"`iscoroutine`."
875
878
msgstr ""
879
+ "可能なら、 :keyword:`async def` を使った関数定義が好ましいです。また、関数を"
880
+ "呼び出した上でその戻り値を :func:`iscoroutine` でテストする方法も容認できま"
881
+ "す。"
876
882
877
883
#: ../../library/inspect.rst:456
878
884
msgid ""
@@ -893,6 +899,7 @@ msgid ""
893
899
"Can also be used to distinguish generator-based coroutines from regular "
894
900
"generators:"
895
901
msgstr ""
902
+ "ジェネレータベースのコルーチンと通常のジェネレータを区別するのにも使えます:"
896
903
897
904
#: ../../library/inspect.rst:469
898
905
msgid ""
@@ -907,12 +914,24 @@ msgid ""
907
914
"assert not isawaitable(gen())\n"
908
915
"assert isawaitable(gen_coro())"
909
916
msgstr ""
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())"
910
927
911
928
#: ../../library/inspect.rst:487
912
929
msgid ""
913
930
"Return ``True`` if the object is an :term:`asynchronous generator` function, "
914
931
"for example:"
915
932
msgstr ""
933
+ "オブジェクトが非同期ジェネレータ :term:`asynchronous generator` 関数である場"
934
+ "合に ``True`` を返します。使用例:"
916
935
917
936
#: ../../library/inspect.rst:490
918
937
msgid ""
@@ -922,12 +941,20 @@ msgid ""
922
941
">>> inspect.isasyncgenfunction(agen)\n"
923
942
"True"
924
943
msgstr ""
944
+ ">>> async def agen():\n"
945
+ "... yield 1\n"
946
+ "...\n"
947
+ ">>> inspect.isasyncgenfunction(agen)\n"
948
+ "True"
925
949
926
950
#: ../../library/inspect.rst:500
927
951
msgid ""
928
952
"Functions wrapped in :func:`functools.partial` now return ``True`` if the "
929
953
"wrapped function is an :term:`asynchronous generator` function."
930
954
msgstr ""
955
+ ":func:`functools.partial` でラップされた関数でも、元の関数が非同期ジェネレー"
956
+ "タ :term:`asynchronous generator` 関数であれば ``True`` を返すようになりまし"
957
+ "た。"
931
958
932
959
#: ../../library/inspect.rst:510
933
960
msgid ""
@@ -961,12 +988,17 @@ msgstr ""
961
988
msgid ""
962
989
"Return ``True`` if the type of object is a :class:`~types.MethodWrapperType`."
963
990
msgstr ""
991
+ "オブジェクトの型が :class:`~types.MethodWrapperType` である場合に ``True`` を"
992
+ "返します。"
964
993
965
994
#: ../../library/inspect.rst:539
966
995
msgid ""
967
996
"These are instances of :class:`~types.MethodWrapperType`, such as :meth:"
968
997
"`~object.__str__`, :meth:`~object.__eq__` and :meth:`~object.__repr__`."
969
998
msgstr ""
999
+ "真を返すのは :class:`~types.MethodWrapperType` のインスタンスで、 :meth:"
1000
+ "`~object.__str__`, :meth:`~object.__eq__`, :meth:`~object.__repr__` などで"
1001
+ "す。"
970
1002
971
1003
#: ../../library/inspect.rst:547
972
1004
msgid ""
@@ -998,6 +1030,11 @@ msgid ""
998
1030
"attributes varies. A :attr:`~definition.__name__` attribute is usually "
999
1031
"sensible, and :attr:`~definition.__doc__` often is."
1000
1032
msgstr ""
1033
+ "これはたとえば、 ``int.__add__`` で真を返します。この関数によるテストをパスす"
1034
+ "る(真を返す)オブジェクトは :meth:`~object.__get__` メソッドを持ちますが、 :"
1035
+ "meth:`~object.__set__` メソッドや :meth:`~object.__delete__` メソッドは持ちま"
1036
+ "せん。それ以外の属性の有無はさまざまです。 :attr:`~definition.__name__` 属性"
1037
+ "は普通は存在しますし、 :attr:`~definition.__doc__` 属性もしばしば見られます。"
1001
1038
1002
1039
#: ../../library/inspect.rst:567
1003
1040
msgid ""
@@ -1006,6 +1043,11 @@ msgid ""
1006
1043
"the other tests promise more -- you can, e.g., count on having the :attr:"
1007
1044
"`~method.__func__` attribute (etc) when an object passes :func:`ismethod`."
1008
1045
msgstr ""
1046
+ "デスクリプタによって実装されたメソッドがこのメソッド以外のテストをパスする場"
1047
+ "合、 :func:`ismethoddescriptor` によるテストでは ``False`` を返します。これは"
1048
+ "単純に、他のテストはより多くを約束するからです -- たとえば、あるオブジェクト"
1049
+ "が :func:`ismethod` のテストをパスするとき、そのオブジェクトが :attr:"
1050
+ "`~method.__func__` 属性 (など) を持っていることを期待することができます。"
1009
1051
1010
1052
#: ../../library/inspect.rst:573
1011
1053
msgid ""
@@ -1014,6 +1056,10 @@ msgid ""
1014
1056
"being method descriptors (such objects are data descriptors, not method "
1015
1057
"descriptors)."
1016
1058
msgstr ""
1059
+ "この関数は、 :meth:`~object.__get__` 属性と :meth:`~object.__delete__` 属性を"
1060
+ "持ち、 :meth:`~object.__set__` 属性を持たないオブジェクトをメソッドデスクリプ"
1061
+ "タであると不正に報告することはなくなりました (そのようなオブジェクトはデータ"
1062
+ "デスクリプタであって、メソッドデスクリプタではありません)。"
1017
1063
1018
1064
#: ../../library/inspect.rst:581
1019
1065
msgid "Return ``True`` if the object is a data descriptor."
@@ -1029,6 +1075,14 @@ msgid ""
1029
1075
"`~definition.__name__` and :attr:`!__doc__` attributes (properties, getsets, "
1030
1076
"and members have both of these attributes), but this is not guaranteed."
1031
1077
msgstr ""
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つの属性を両方持っています)。"
1032
1086
1033
1087
#: ../../library/inspect.rst:594
1034
1088
msgid "Return ``True`` if the object is a getset descriptor."